From 3b36b9e4e2537e54bb146e9803ceae4fdcbf6e14 Mon Sep 17 00:00:00 2001 From: Gabriel Moisan Matte Date: Tue, 17 Sep 2024 22:45:54 -0400 Subject: [PATCH 01/10] Create create-branch-images.yml --- .github/workflows/create-branch-images.yml | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 .github/workflows/create-branch-images.yml diff --git a/.github/workflows/create-branch-images.yml b/.github/workflows/create-branch-images.yml new file mode 100644 index 0000000..e928ab5 --- /dev/null +++ b/.github/workflows/create-branch-images.yml @@ -0,0 +1,82 @@ +name: create-branch-images + +on: + workflow_call: + workflow_dispatch: + push: + branches: + - '**' + tags: + - '**' + +jobs: + docker: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: | + ghcr.io/${{ github.repository }}/frontend + ghcr.io/${{ github.repository }}/backend + ghcr.io/${{ github.repository }}/router + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + + - name: Build and push frontend Docker image + uses: docker/build-push-action@v3 + with: + context: ./client + push: ${{ github.event_name != 'pull_request' }} + platforms: linux/amd64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Build and push backend Docker image + uses: docker/build-push-action@v3 + with: + context: ./server + push: ${{ github.event_name != 'pull_request' }} + platforms: linux/amd64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Build and push router Docker image + uses: docker/build-push-action@v3 + with: + context: ./nginx + push: ${{ github.event_name != 'pull_request' }} + platforms: linux/amd64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max From 3195a7a4a9bec97f479b87688fdf351266111874 Mon Sep 17 00:00:00 2001 From: gab9281 Date: Wed, 18 Sep 2024 16:36:19 -0400 Subject: [PATCH 02/10] removes instant branch image making --- .github/workflows/create-branch-images.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/create-branch-images.yml b/.github/workflows/create-branch-images.yml index e928ab5..4be6469 100644 --- a/.github/workflows/create-branch-images.yml +++ b/.github/workflows/create-branch-images.yml @@ -4,8 +4,6 @@ on: workflow_call: workflow_dispatch: push: - branches: - - '**' tags: - '**' From 023476dd0b5284aa06c5041a51cd8f9c04dfdfea Mon Sep 17 00:00:00 2001 From: gab9281 Date: Wed, 18 Sep 2024 16:36:40 -0400 Subject: [PATCH 03/10] adds back preprod and staging --- .github/workflows/create-branch-images.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-branch-images.yml b/.github/workflows/create-branch-images.yml index 4be6469..4a0ea1d 100644 --- a/.github/workflows/create-branch-images.yml +++ b/.github/workflows/create-branch-images.yml @@ -4,9 +4,12 @@ on: workflow_call: workflow_dispatch: push: + branches: + - 'main' + - 'dev' tags: - '**' - + jobs: docker: runs-on: ubuntu-latest From 320f98a8a753e5b583216d26401f4808f18b0c2c Mon Sep 17 00:00:00 2001 From: MathieuSevignyLavallee <89943988+MathieuSevignyLavallee@users.noreply.github.com> Date: Thu, 19 Sep 2024 17:10:41 -0400 Subject: [PATCH 04/10] Auth config .env.auth for docker-compose and Load environment variables in the backend --- .env.auth | 22 ++++++++++++++++++++++ docker-compose.yaml | 2 ++ server/config/auth.js | 30 ++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 .env.auth create mode 100644 server/config/auth.js diff --git a/.env.auth b/.env.auth new file mode 100644 index 0000000..f86d774 --- /dev/null +++ b/.env.auth @@ -0,0 +1,22 @@ +# Type of Autorizarions +SIMPLE_LOGIN_ACTIVE=false +OAUTH_ACTIVE=false +OIDC_ACTIVE=false + +# Configuration Simple Login +SESSION_SECRET=your_session_secret + +# Configuration OAuth +OAUTH_AUTHORIZATION_URL=https://www.testurl.com/oauth2/authorize +OAUTH_TOKEN_URL=https://www.testurl.com/oauth2/token +OAUTH_CLIENT_ID=your_oauth_client_id +OAUTH_CLIENT_SECRET=your_oauth_client_secret +OAUTH_CALLBACK_URL=https://localhost:3000/auth/provider/callback +OAUTH_ADD_SCOPE=scopes +OAUTH_ROLE_TEACHER_VALUE=teacher-claim-value + +# Configuration OIDC +OIDC_CLIENT_ID=your_oidc_client_id +OIDC_CLIENT_SECRET=your_oidc_client_secret +OIDC_ISSUER_URL=https://your-issuer.com +OIDC_CALLBACK_URL=http://localhost:3000/auth/oidc/callback diff --git a/docker-compose.yaml b/docker-compose.yaml index 284a46e..93e29f2 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -14,6 +14,8 @@ services: container_name: backend ports: - "3000:3000" + env_file: + - .env.auth environment: PORT: 3000 MONGO_URI: "mongodb://mongo:27017/evaluetonsavoir" diff --git a/server/config/auth.js b/server/config/auth.js new file mode 100644 index 0000000..167512e --- /dev/null +++ b/server/config/auth.js @@ -0,0 +1,30 @@ +require('dotenv').config({ path: './.env.auth' }); + +module.exports = { + // Activer ou désactiver les types d'authentifications + simpleLoginActive: process.env.SIMPLE_LOGIN_ACTIVE === 'true', + oauthActive: process.env.OAUTH_ACTIVE === 'true', + oidcActive: process.env.OIDC_ACTIVE === 'true', + + // Configuration Simple Login + sessionSecret: process.env.SESSION_SECRET || 'default_session_secret', + + // Configuration OAuth + oauth: { + authorizationURL: process.env.OAUTH_AUTHORIZATION_URL || '', + tokenURL: process.env.OAUTH_TOKEN_URL || '', + clientID: process.env.OAUTH_CLIENT_ID || '', + clientSecret: process.env.OAUTH_CLIENT_SECRET || '', + callbackURL: process.env.OAUTH_CALLBACK_URL || '', + scope: process.env.OAUTH_ADD_SCOPE || '', + teacherRoleClaim: process.env.OAUTH_ROLE_TEACHER_VALUE || '', + }, + + // Configuration OIDC + oidc: { + clientID: process.env.OIDC_CLIENT_ID || '', + clientSecret: process.env.OIDC_CLIENT_SECRET || '', + issuerURL: process.env.OIDC_ISSUER_URL || '', + callbackURL: process.env.OIDC_CALLBACK_URL || '', + } +}; From e3de6853c74af76b2027549ae3921b5068b35bc4 Mon Sep 17 00:00:00 2001 From: MathieuSevignyLavallee <89943988+MathieuSevignyLavallee@users.noreply.github.com> Date: Sun, 22 Sep 2024 10:41:02 -0400 Subject: [PATCH 05/10] studentRoleClaim --- .env.auth | 1 + server/config/auth.js | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.env.auth b/.env.auth index f86d774..18c9a63 100644 --- a/.env.auth +++ b/.env.auth @@ -14,6 +14,7 @@ OAUTH_CLIENT_SECRET=your_oauth_client_secret OAUTH_CALLBACK_URL=https://localhost:3000/auth/provider/callback OAUTH_ADD_SCOPE=scopes OAUTH_ROLE_TEACHER_VALUE=teacher-claim-value +OAUTH_ROLE_STUDENT_VALUE=student-claim-value # Configuration OIDC OIDC_CLIENT_ID=your_oidc_client_id diff --git a/server/config/auth.js b/server/config/auth.js index 167512e..c1effd2 100644 --- a/server/config/auth.js +++ b/server/config/auth.js @@ -1,15 +1,15 @@ require('dotenv').config({ path: './.env.auth' }); module.exports = { - // Activer ou désactiver les types d'authentifications + // Enable or disable the types of authentications simpleLoginActive: process.env.SIMPLE_LOGIN_ACTIVE === 'true', - oauthActive: process.env.OAUTH_ACTIVE === 'true', - oidcActive: process.env.OIDC_ACTIVE === 'true', + oauthActive: process.env.OAUTH_ACTIVE === 'false', + oidcActive: process.env.OIDC_ACTIVE === 'false', - // Configuration Simple Login + // Simple Login Configuration sessionSecret: process.env.SESSION_SECRET || 'default_session_secret', - // Configuration OAuth + // OAuth Configuration oauth: { authorizationURL: process.env.OAUTH_AUTHORIZATION_URL || '', tokenURL: process.env.OAUTH_TOKEN_URL || '', @@ -18,9 +18,10 @@ module.exports = { callbackURL: process.env.OAUTH_CALLBACK_URL || '', scope: process.env.OAUTH_ADD_SCOPE || '', teacherRoleClaim: process.env.OAUTH_ROLE_TEACHER_VALUE || '', + studentRoleClaim: process.env.OAUTH_ROLE_STUDENT_VALUE || '', // Added based on env file }, - // Configuration OIDC + // OIDC Configuration oidc: { clientID: process.env.OIDC_CLIENT_ID || '', clientSecret: process.env.OIDC_CLIENT_SECRET || '', From 6dde0cca386e307f1abd5d1e2b38e056c1164774 Mon Sep 17 00:00:00 2001 From: MathieuSevignyLavallee <89943988+MathieuSevignyLavallee@users.noreply.github.com> Date: Sun, 22 Sep 2024 14:52:41 -0400 Subject: [PATCH 06/10] Routes for Auth Backend routes simple pour envoyer au frontend quel type de auth est disponible --- .env.auth | 2 +- server/app.js | 2 ++ server/config/auth.js | 4 +--- server/controllers/auth.js | 23 +++++++++++++++++++++++ server/routers/auth.js | 9 +++++++++ 5 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 server/controllers/auth.js create mode 100644 server/routers/auth.js diff --git a/.env.auth b/.env.auth index 18c9a63..65fb680 100644 --- a/.env.auth +++ b/.env.auth @@ -1,5 +1,5 @@ # Type of Autorizarions -SIMPLE_LOGIN_ACTIVE=false +SIMPLE_LOGIN_ACTIVE=true OAUTH_ACTIVE=false OIDC_ACTIVE=false diff --git a/server/app.js b/server/app.js index 76053ba..88e8da4 100644 --- a/server/app.js +++ b/server/app.js @@ -12,6 +12,7 @@ const userRouter = require('./routers/users.js'); const folderRouter = require('./routers/folders.js'); const quizRouter = require('./routers/quiz.js'); const imagesRouter = require('./routers/images.js') +const authRouter = require('./routers/auth.js') // Setup environement dotenv.config(); @@ -48,6 +49,7 @@ app.use('/api/user', userRouter); app.use('/api/folder', folderRouter); app.use('/api/quiz', quizRouter); app.use('/api/image', imagesRouter); +app.use('/api/auth', authRouter); app.use(errorHandler) diff --git a/server/config/auth.js b/server/config/auth.js index c1effd2..b675ce1 100644 --- a/server/config/auth.js +++ b/server/config/auth.js @@ -1,5 +1,3 @@ -require('dotenv').config({ path: './.env.auth' }); - module.exports = { // Enable or disable the types of authentications simpleLoginActive: process.env.SIMPLE_LOGIN_ACTIVE === 'true', @@ -18,7 +16,7 @@ module.exports = { callbackURL: process.env.OAUTH_CALLBACK_URL || '', scope: process.env.OAUTH_ADD_SCOPE || '', teacherRoleClaim: process.env.OAUTH_ROLE_TEACHER_VALUE || '', - studentRoleClaim: process.env.OAUTH_ROLE_STUDENT_VALUE || '', // Added based on env file + studentRoleClaim: process.env.OAUTH_ROLE_STUDENT_VALUE || '', }, // OIDC Configuration diff --git a/server/controllers/auth.js b/server/controllers/auth.js new file mode 100644 index 0000000..f468216 --- /dev/null +++ b/server/controllers/auth.js @@ -0,0 +1,23 @@ +const authConfig = require('../config/auth.js'); + +class authController { + + async getActive(req, res, next) { + try { + console.log(authConfig); + const authServices = { + simpleLoginActive: authConfig.simpleLoginActive, + oauthActive: authConfig.oauthActive, + oidcActive: authConfig.oidcActive + }; + + res.json(authServices); + } + catch (error) { + return next(error); + } + } + +} + +module.exports = new authController; \ No newline at end of file diff --git a/server/routers/auth.js b/server/routers/auth.js new file mode 100644 index 0000000..7fce26c --- /dev/null +++ b/server/routers/auth.js @@ -0,0 +1,9 @@ +const express = require('express'); +const router = express.Router(); +const jwt = require('../middleware/jwtToken.js'); + +const authController = require('../controllers/auth.js') + +router.get("/getActiveAuth", authController.getActive); + +module.exports = router; \ No newline at end of file From 97e7a4888fa789692a0e7a46bb04a112e3630231 Mon Sep 17 00:00:00 2001 From: MathieuSevignyLavallee <89943988+MathieuSevignyLavallee@users.noreply.github.com> Date: Sun, 22 Sep 2024 15:01:29 -0400 Subject: [PATCH 07/10] ajustement auth env --- server/config/auth.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/config/auth.js b/server/config/auth.js index b675ce1..dbcdca8 100644 --- a/server/config/auth.js +++ b/server/config/auth.js @@ -1,8 +1,8 @@ module.exports = { // Enable or disable the types of authentications - simpleLoginActive: process.env.SIMPLE_LOGIN_ACTIVE === 'true', - oauthActive: process.env.OAUTH_ACTIVE === 'false', - oidcActive: process.env.OIDC_ACTIVE === 'false', + simpleLoginActive: process.env.SIMPLE_LOGIN_ACTIVE || 'true', + oauthActive: process.env.OAUTH_ACTIVE || 'false', + oidcActive: process.env.OIDC_ACTIVE || 'false', // Simple Login Configuration sessionSecret: process.env.SESSION_SECRET || 'default_session_secret', From 4849380b731cd6c5410583f48d4f46e9143b7b33 Mon Sep 17 00:00:00 2001 From: MathieuSevignyLavallee <89943988+MathieuSevignyLavallee@users.noreply.github.com> Date: Sun, 22 Sep 2024 21:00:15 -0400 Subject: [PATCH 08/10] Dynamic auth config --- .env.auth | 23 ------------ auth_config.json | 32 ++++++++++++++++ docker-compose.yaml | 2 + server/config/auth.js | 75 +++++++++++++++++++++++++------------- server/controllers/auth.js | 17 +++++---- 5 files changed, 93 insertions(+), 56 deletions(-) delete mode 100644 .env.auth create mode 100644 auth_config.json diff --git a/.env.auth b/.env.auth deleted file mode 100644 index 65fb680..0000000 --- a/.env.auth +++ /dev/null @@ -1,23 +0,0 @@ -# Type of Autorizarions -SIMPLE_LOGIN_ACTIVE=true -OAUTH_ACTIVE=false -OIDC_ACTIVE=false - -# Configuration Simple Login -SESSION_SECRET=your_session_secret - -# Configuration OAuth -OAUTH_AUTHORIZATION_URL=https://www.testurl.com/oauth2/authorize -OAUTH_TOKEN_URL=https://www.testurl.com/oauth2/token -OAUTH_CLIENT_ID=your_oauth_client_id -OAUTH_CLIENT_SECRET=your_oauth_client_secret -OAUTH_CALLBACK_URL=https://localhost:3000/auth/provider/callback -OAUTH_ADD_SCOPE=scopes -OAUTH_ROLE_TEACHER_VALUE=teacher-claim-value -OAUTH_ROLE_STUDENT_VALUE=student-claim-value - -# Configuration OIDC -OIDC_CLIENT_ID=your_oidc_client_id -OIDC_CLIENT_SECRET=your_oidc_client_secret -OIDC_ISSUER_URL=https://your-issuer.com -OIDC_CALLBACK_URL=http://localhost:3000/auth/oidc/callback diff --git a/auth_config.json b/auth_config.json new file mode 100644 index 0000000..d5569e5 --- /dev/null +++ b/auth_config.json @@ -0,0 +1,32 @@ +{ + "auth": { + "passportjs": [ + { + "provider1": { + "OAUTH_AUTHORIZATION_URL": "https://www.testurl.com/oauth2/authorize", + "OAUTH_TOKEN_URL": "https://www.testurl.com/oauth2/token", + "OAUTH_CLIENT_ID": "your_oauth_client_id", + "OAUTH_CLIENT_SECRET": "your_oauth_client_secret", + "OAUTH_CALLBACK_URL": "https://localhost:3000/auth/provider/callback", + "OAUTH_ADD_SCOPE": "scopes", + "OAUTH_ROLE_TEACHER_VALUE": "teacher-claim-value", + "OAUTH_ROLE_STUDENT_VALUE": "student-claim-value" + } + }, + { + "provider2": { + "type": "oidc", + "OIDC_CLIENT_ID": "your_oidc_client_id", + "OIDC_CLIENT_SECRET": "your_oidc_client_secret", + "OIDC_ISSUER_URL": "https://your-issuer.com", + "OIDC_CALLBACK_URL": "http://localhost:3000/auth/oidc/callback" + } + } + ], + "simple-login": { + "enabled": true, + "name": "provider3", + "SESSION_SECRET": "your_session_secret" + } + } +} \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 93e29f2..9f91bd6 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -25,6 +25,8 @@ services: EMAIL_PSW: 'vvml wmfr dkzb vjzb' JWT_SECRET: haQdgd2jp09qb897GeBZyJetC8ECSpbFJe FRONTEND_URL: "http://localhost:5173" + volumes: + - ./auth_config.json:/usr/src/app/serveur/config/auth_config.json depends_on: - mongo restart: always diff --git a/server/config/auth.js b/server/config/auth.js index dbcdca8..493dd0c 100644 --- a/server/config/auth.js +++ b/server/config/auth.js @@ -1,29 +1,52 @@ -module.exports = { - // Enable or disable the types of authentications - simpleLoginActive: process.env.SIMPLE_LOGIN_ACTIVE || 'true', - oauthActive: process.env.OAUTH_ACTIVE || 'false', - oidcActive: process.env.OIDC_ACTIVE || 'false', +const fs = require('fs'); +const path = require('path'); - // Simple Login Configuration - sessionSecret: process.env.SESSION_SECRET || 'default_session_secret', +class AuthConfig { - // OAuth Configuration - oauth: { - authorizationURL: process.env.OAUTH_AUTHORIZATION_URL || '', - tokenURL: process.env.OAUTH_TOKEN_URL || '', - clientID: process.env.OAUTH_CLIENT_ID || '', - clientSecret: process.env.OAUTH_CLIENT_SECRET || '', - callbackURL: process.env.OAUTH_CALLBACK_URL || '', - scope: process.env.OAUTH_ADD_SCOPE || '', - teacherRoleClaim: process.env.OAUTH_ROLE_TEACHER_VALUE || '', - studentRoleClaim: process.env.OAUTH_ROLE_STUDENT_VALUE || '', - }, - - // OIDC Configuration - oidc: { - clientID: process.env.OIDC_CLIENT_ID || '', - clientSecret: process.env.OIDC_CLIENT_SECRET || '', - issuerURL: process.env.OIDC_ISSUER_URL || '', - callbackURL: process.env.OIDC_CALLBACK_URL || '', + constructor(configPath) { + this.configPath = configPath; + this.config = this.loadConfig(); } -}; + + // Méthode pour lire le fichier de configuration JSON + loadConfig() { + try { + const configData = fs.readFileSync(this.configPath, 'utf-8'); + return JSON.parse(configData); + } catch (error) { + console.error("Erreur lors de la lecture du fichier de configuration :", error); + return null; + } + } + + // Méthode pour retourner la configuration des fournisseurs PassportJS + getPassportJSConfig() { + if (this.config && this.config.auth && this.config.auth.passportjs) { + const passportConfig = {}; + + this.config.auth.passportjs.forEach(provider => { + const providerName = Object.keys(provider)[0]; + passportConfig[providerName] = provider[providerName]; + }); + + return passportConfig; + } else { + return { error: "Aucune configuration PassportJS disponible." }; + } + } + + // Méthode pour retourner la configuration de Simple Login + getSimpleLoginConfig() { + if (this.config && this.config.auth && this.config.auth["simple-login"]) { + return this.config.auth["simple-login"]; + } else { + return { error: "Aucune configuration Simple Login disponible." }; + } + } +} + +// Utilisation de la classe ConfigManager +const configPath = path.join(__dirname, './auth_config.json'); +const instance = new AuthConfig(configPath); +module.exports = instance; + diff --git a/server/controllers/auth.js b/server/controllers/auth.js index f468216..8d7fa53 100644 --- a/server/controllers/auth.js +++ b/server/controllers/auth.js @@ -3,18 +3,21 @@ const authConfig = require('../config/auth.js'); class authController { async getActive(req, res, next) { + try { - console.log(authConfig); - const authServices = { - simpleLoginActive: authConfig.simpleLoginActive, - oauthActive: authConfig.oauthActive, - oidcActive: authConfig.oidcActive + + const passportConfig = authConfig.getPassportJSConfig(); + const simpleLoginConfig = authConfig.getSimpleLoginConfig(); + + const response = { + passportConfig, + simpleLoginConfig }; - res.json(authServices); + return res.json(response); } catch (error) { - return next(error); + return next(error); // Gérer l'erreur } } From 5040c2189ddd72b09ea4764973b7ac8128489360 Mon Sep 17 00:00:00 2001 From: MathieuSevignyLavallee <89943988+MathieuSevignyLavallee@users.noreply.github.com> Date: Sun, 22 Sep 2024 21:04:07 -0400 Subject: [PATCH 09/10] jwt auth for route auth --- server/routers/auth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/routers/auth.js b/server/routers/auth.js index 7fce26c..8e8fb4a 100644 --- a/server/routers/auth.js +++ b/server/routers/auth.js @@ -4,6 +4,6 @@ const jwt = require('../middleware/jwtToken.js'); const authController = require('../controllers/auth.js') -router.get("/getActiveAuth", authController.getActive); +router.get("/getActiveAuth",jwt.authenticate, authController.getActive); module.exports = router; \ No newline at end of file From 052de4dd9d86e6ecb8c67a43c06fb74eca72dec4 Mon Sep 17 00:00:00 2001 From: MathieuSevignyLavallee <89943988+MathieuSevignyLavallee@users.noreply.github.com> Date: Mon, 23 Sep 2024 16:24:07 -0400 Subject: [PATCH 10/10] cleanup --- docker-compose.yaml | 2 -- server/config/auth.js | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 9f91bd6..077e2ae 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -14,8 +14,6 @@ services: container_name: backend ports: - "3000:3000" - env_file: - - .env.auth environment: PORT: 3000 MONGO_URI: "mongodb://mongo:27017/evaluetonsavoir" diff --git a/server/config/auth.js b/server/config/auth.js index 493dd0c..fffb426 100644 --- a/server/config/auth.js +++ b/server/config/auth.js @@ -1,5 +1,6 @@ const fs = require('fs'); const path = require('path'); +const pathAuthConfig = './auth_config.json'; class AuthConfig { @@ -46,7 +47,7 @@ class AuthConfig { } // Utilisation de la classe ConfigManager -const configPath = path.join(__dirname, './auth_config.json'); +const configPath = path.join(__dirname, pathAuthConfig); const instance = new AuthConfig(configPath); module.exports = instance;