From 6097be3c79ea7eb3b4228f825ca3375f77b8ea57 Mon Sep 17 00:00:00 2001 From: Tibo De Peuter Date: Thu, 3 Apr 2025 08:31:25 +0200 Subject: [PATCH 1/3] test(backend): Omgevingsvariabelen files --- backend/.env.staging | 21 +++++++++++++++++++++ backend/.env.test | 14 ++++++++++++-- backend/.env.test.example | 13 ------------- compose.staging.yml | 2 +- 4 files changed, 34 insertions(+), 16 deletions(-) create mode 100644 backend/.env.staging delete mode 100644 backend/.env.test.example diff --git a/backend/.env.staging b/backend/.env.staging new file mode 100644 index 00000000..bedfb0b7 --- /dev/null +++ b/backend/.env.staging @@ -0,0 +1,21 @@ +PORT=3000 +DWENGO_DB_HOST=db +DWENGO_DB_PORT=5432 +DWENGO_DB_USERNAME=postgres +DWENGO_DB_PASSWORD=postgres +DWENGO_DB_UPDATE=false + +DWENGO_AUTH_STUDENT_URL=http://localhost/idp/realms/student +DWENGO_AUTH_STUDENT_CLIENT_ID=dwengo +DWENGO_AUTH_STUDENT_JWKS_ENDPOINT=http://idp:7080/idp/realms/student/protocol/openid-connect/certs +DWENGO_AUTH_TEACHER_URL=http://localhost/idp/realms/teacher +DWENGO_AUTH_TEACHER_CLIENT_ID=dwengo +DWENGO_AUTH_TEACHER_JWKS_ENDPOINT=http://idp:7080/idp/realms/teacher/protocol/openid-connect/certs + +# Allow Vite dev-server to access the backend (for testing purposes). Don't forget to remove this in production! +#DWENGO_CORS_ALLOWED_ORIGINS=http://localhost/,127.0.0.1:80,http://127.0.0.1,http://localhost:80,http://127.0.0.1:80,localhost +DWENGO_CORS_ALLOWED_ORIGINS=http://localhost/*,http://idp:7080,https://idp:7080 + +# Logging and monitoring + +LOKI_HOST=http://logging:3102 diff --git a/backend/.env.test b/backend/.env.test index b8a81003..535628cd 100644 --- a/backend/.env.test +++ b/backend/.env.test @@ -1,3 +1,13 @@ -PORT=3000 -DWENGO_DB_UPDATE=true +# +# Test environment configuration +# +# Should not need to be modified. +# See .env.example for more information. +# + +### Dwengo ### + +DWENGO_PORT=3000 + DWENGO_DB_NAME=":memory:" +DWENGO_DB_UPDATE=true diff --git a/backend/.env.test.example b/backend/.env.test.example deleted file mode 100644 index 535628cd..00000000 --- a/backend/.env.test.example +++ /dev/null @@ -1,13 +0,0 @@ -# -# Test environment configuration -# -# Should not need to be modified. -# See .env.example for more information. -# - -### Dwengo ### - -DWENGO_PORT=3000 - -DWENGO_DB_NAME=":memory:" -DWENGO_DB_UPDATE=true diff --git a/compose.staging.yml b/compose.staging.yml index 8357e773..16814b77 100644 --- a/compose.staging.yml +++ b/compose.staging.yml @@ -24,7 +24,7 @@ services: - '3000:3000/tcp' restart: unless-stopped volumes: - - ./backend/.env:/app/.env + - ./backend/.env.staging:/app/.env depends_on: - db - logging From 8a0b4b62a70ad8158de821643daa28a1fd255273 Mon Sep 17 00:00:00 2001 From: Tibo De Peuter Date: Thu, 3 Apr 2025 08:32:32 +0200 Subject: [PATCH 2/3] test(backend): Verhoog vitest timeout --- backend/vitest.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/vitest.config.ts b/backend/vitest.config.ts index 461d2018..29142c49 100644 --- a/backend/vitest.config.ts +++ b/backend/vitest.config.ts @@ -4,6 +4,6 @@ export default defineConfig({ test: { environment: 'node', globals: true, - testTimeout: 10000, + testTimeout: 100000, }, }); From 86b3e0e4c4f16d3dd6ba724515fbb2ff46cfafc3 Mon Sep 17 00:00:00 2001 From: Tibo De Peuter Date: Thu, 3 Apr 2025 08:52:23 +0200 Subject: [PATCH 3/3] docs: Omgevingsbestanden --- README.md | 6 +----- backend/README.md | 4 +++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3526b53d..0499b037 100644 --- a/README.md +++ b/README.md @@ -35,12 +35,8 @@ Om de applicatie lokaal te draaien als kant-en-klare Docker-containers: ```bash docker compose version git clone https://github.com/SELab-2/Dwengo-1.git -cd Dwengo-1/backend -cp .env.example .env -# Pas .env aan -nano .env -cd .. docker compose -f compose.staging.yml up --build +# Gebruikt backend/.env.staging ``` ### Handmatige installatie en ontwikkeling diff --git a/backend/README.md b/backend/README.md index 8a78ed14..ded42bd8 100644 --- a/backend/README.md +++ b/backend/README.md @@ -34,7 +34,9 @@ npm run test:unit ```shell # Omgevingsvariabelen -cp .env.development.example .env +cp .env.example .env +# Configureer de .env file met de juiste waarden! +nano .env npm run build npm run start