From 3da3d9bebde4db7f3f2476bed82795a4b9791f99 Mon Sep 17 00:00:00 2001 From: Matt Jaquiery Date: Mon, 27 Feb 2023 11:19:14 +0000 Subject: [PATCH] Bugfixes (#50) - closes #48 - fixed incorrect API call endpoint - closes #47 - added volume override for `/app/node_modules/` - closes #49 - use `.env.secret` in tests; create `.env.secret` in GitHub tests from envvars --- .github/workflows/unit-test.yml | 10 ++++++++-- docker-compose.test.yml | 10 ++++------ docker-compose.yml | 1 + frontend/src/APIConnection.ts | 2 +- frontend/src/Login.tsx | 9 +++++++++ 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 6686465b..003701be 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -38,7 +38,7 @@ jobs: sudo smbget -R $LIIONSDEN_SMB_PATH/test-suite-small -U "$LIIONSDEN_SMB_USERNAME%$LIIONSDEN_SMB_PASSWORD" - name: Build the stack - run: docker-compose -f docker-compose.test.yml build harvester + run: touch .env.secret && docker-compose -f docker-compose.test.yml build harvester # Enable tmate debugging of manually-triggered workflows if the input option was provided - name: Setup tmate session @@ -57,8 +57,14 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Set up secrets + run: | + echo "POSTGRES_PASSWORD=$POSTGRES_PASSWORD" > .env.secret + echo "DJANGO_SECRET_KEY=$DJANGO_SECRET_KEY" >> .env.secret + echo "DJANGO_TEST=$DJANGO_TEST" >> .env.secret + - name: Build the stack - run: touch .env.secret && docker-compose -f docker-compose.test.yml up -d --build app_test + run: docker-compose -f docker-compose.test.yml up -d --build app_test # Enable tmate debugging of manually-triggered workflows if the input option was provided - name: Setup tmate session diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 282b6b9d..a8fe454f 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -9,8 +9,8 @@ services: command: -p 5433 volumes: - "${GALVANALYSER_DATA_PATH}:/var/lib/postgresql/data" - environment: - POSTGRES_PASSWORD: "galvanalyser" + env_file: + - .env.secret restart: unless-stopped app_test: @@ -27,10 +27,8 @@ services: working_dir: /usr/app/backend_django command: ../server.sh # command: tail -F anything - environment: - POSTGRES_PASSWORD: "galvanalyser" - DJANGO_SECRET_KEY: "long-and-insecure-key-12345" - DJANGO_TEST: "TRUE" + env_file: + - .env.secret harvester: build: diff --git a/docker-compose.yml b/docker-compose.yml index 5cfde037..80525fbc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,6 +29,7 @@ services: - "80:80" volumes: - ./frontend:/app + - /app/node_modules/ working_dir: /app env_file: - ./.env diff --git a/frontend/src/APIConnection.ts b/frontend/src/APIConnection.ts index 1891aac6..98fff870 100644 --- a/frontend/src/APIConnection.ts +++ b/frontend/src/APIConnection.ts @@ -111,7 +111,7 @@ export class APIConnection { create_user(username: string, email: string, password: string): Promise { return fetch( - this.url + 'users/', + this.url + 'inactive_users/', { method: 'POST', headers: {accept: 'application/json', 'content-type': 'application/json'}, diff --git a/frontend/src/Login.tsx b/frontend/src/Login.tsx index 3ffb9061..85e0d8e7 100644 --- a/frontend/src/Login.tsx +++ b/frontend/src/Login.tsx @@ -121,6 +121,15 @@ export default function Login() { To activate a user, log in to Galvanalyser as an active user and select the appropriate inactive user from the 'users' tab on the left. + const formContent =