diff --git a/gatewayservice/Dockerfile b/gatewayservice/Dockerfile index 136cbc0..47f2bb9 100644 --- a/gatewayservice/Dockerfile +++ b/gatewayservice/Dockerfile @@ -11,7 +11,7 @@ COPY package*.json ./ RUN npm install --ignore-scripts # Copy the app source code to the working directory -COPY . . /usr/src/gatewayservice/ +COPY gateway-service.js ./ # Define the command to run your app CMD ["node", "gateway-service.js"] diff --git a/questionservice/Dockerfile b/questionservice/Dockerfile index 438c0b9..3fe633a 100644 --- a/questionservice/Dockerfile +++ b/questionservice/Dockerfile @@ -14,7 +14,8 @@ RUN npm install axios --ignore-scripts RUN npm install --ignore-scripts # Copy the app source code to the working directory -COPY . . /usr/src/questionservice/ +COPY server.js ./ +COPY questions.json ./ # Define the command to run your app CMD ["node", "server.js"] diff --git a/questionservice/server.js b/questionservice/server.js index c816c78..28e42c2 100644 --- a/questionservice/server.js +++ b/questionservice/server.js @@ -70,7 +70,9 @@ app.get('/pregunta', async (req, res) => { } // Mezclamos las respuestas for (let i = answers.length - 1; i > 0; i--) { - const j = Math.floor(Math.random() * (i + 1)); + buf = crypto.randomBytes(1) + randomValue = buf[0]/255 + const j = Math.floor(randomValue * (i + 1)); // Intercambiamos las respuestas en los índices i y j [answers[i], answers[j]] = [answers[j], answers[i]]; } diff --git a/sonar-project.properties b/sonar-project.properties index acbc46c..c96a4d3 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -11,7 +11,8 @@ sonar.language=js sonar.projectName=wiq_es05a sonar.coverage.exclusions=**/*.test.js -sonar.coverage.exclusions=* +sonar.coverage.exclusions=**/*.json, **/*.yaml +sonar.coverage.exclusions=**/Dockerfile, **/*.dockerfile sonar.sources=webapp/src/components,userservice/authservice,userservice/userservice,gatewayservice,questionservice sonar.sourceEncoding=UTF-8 sonar.exclusions=node_modules/** diff --git a/userservice/authservice/Dockerfile b/userservice/authservice/Dockerfile index d6d0fb5..e5fc65d 100644 --- a/userservice/authservice/Dockerfile +++ b/userservice/authservice/Dockerfile @@ -11,7 +11,8 @@ COPY package*.json ./ RUN npm install --ignore-scripts # Copy the app source code to the working directory -COPY . . / /usr/src/authservice/ +COPY auth-service.js ./ +COPY auth-model.js ./ # Expose the port the app runs on EXPOSE 8002 diff --git a/userservice/userservice/Dockerfile b/userservice/userservice/Dockerfile index d8f9099..d80ffb6 100644 --- a/userservice/userservice/Dockerfile +++ b/userservice/userservice/Dockerfile @@ -11,7 +11,8 @@ COPY package*.json ./ RUN npm install --ignore-scripts # Copy the app source code to the working directory -COPY . . /usr/src/userservice/ +COPY user-service.js ./ +COPY user-model.js ./ # Expose the port the app runs on EXPOSE 8001