From 742414d8b7f698bbd239ca340a39f23fd20c3150 Mon Sep 17 00:00:00 2001 From: vrtornisiello Date: Wed, 28 Jan 2026 11:15:25 -0300 Subject: [PATCH 1/4] feat: add algorithm config to JWT token generation --- backend/settings/base.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/settings/base.py b/backend/settings/base.py index 41a14537..e769bc6e 100644 --- a/backend/settings/base.py +++ b/backend/settings/base.py @@ -81,6 +81,7 @@ } SIMPLE_JWT = { + "ALGORITHM": getenv("DJANGO_JWT_ALGORITHM"), "ACCESS_TOKEN_LIFETIME": timedelta(hours=1), "REFRESH_TOKEN_LIFETIME": timedelta(days=7), "USER_AUTHENTICATION_RULE": "backend.apps.chatbot.authentication.authentication_rule", @@ -195,6 +196,7 @@ # GraphQL JWT configurations GRAPHQL_JWT = { "JWT_AUTH_HEADER_PREFIX": "Bearer", + "JWT_ALGORITHM": getenv("DJANGO_JWT_ALGORITHM"), "JWT_VERIFY_EXPIRATION": True, "JWT_EXPIRATION_DELTA": timedelta(days=7), "JWT_REFRESH_EXPIRATION_DELTA": timedelta(days=14), From fc8c4a4a1c1d9edd0249f860f62d1c021db3c81c Mon Sep 17 00:00:00 2001 From: vrtornisiello Date: Wed, 28 Jan 2026 11:18:46 -0300 Subject: [PATCH 2/4] feat: create external network for database access by other services --- compose.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compose.yaml b/compose.yaml index f39fa4d7..246e7020 100644 --- a/compose.yaml +++ b/compose.yaml @@ -44,6 +44,7 @@ services: retries: 5 start_period: 1m restart: unless-stopped + networks: [default, db_network] api: build: context: . @@ -80,3 +81,7 @@ services: volumes: esdata: pgdata: +# External network used for database access by other services (e.g., chatbot API) +networks: + db_network: + name: db_network From 2f009e7bf6c4e28d38df1b5a6abcb37ce4b12c29 Mon Sep 17 00:00:00 2001 From: vrtornisiello Date: Wed, 28 Jan 2026 11:19:16 -0300 Subject: [PATCH 3/4] docs: add jwt algorithm variable to example .env file --- .env.example | 1 + 1 file changed, 1 insertion(+) diff --git a/.env.example b/.env.example index 2cdad9a4..a75a366d 100644 --- a/.env.example +++ b/.env.example @@ -3,6 +3,7 @@ # ============================================================================= # Django +DJANGO_JWT_ALGORITHM=HS256 DJANGO_SECRET_KEY=dev-secret-key-change-in-production DJANGO_SETTINGS_MODULE=backend.settings.local From 8e907fcca36dad1ea10aed75890a4cde905c9bcd Mon Sep 17 00:00:00 2001 From: vrtornisiello Date: Wed, 28 Jan 2026 12:01:04 -0300 Subject: [PATCH 4/4] fix: add api service to `db_network` --- compose.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/compose.yaml b/compose.yaml index 246e7020..fba2bc7d 100644 --- a/compose.yaml +++ b/compose.yaml @@ -13,8 +13,8 @@ services: memlock: soft: -1 hard: -1 - volumes: [esdata:/usr/share/elasticsearch/data] ports: [9200:9200, 9300:9300] + volumes: [esdata:/usr/share/elasticsearch/data] healthcheck: test: [CMD-SHELL, curl -s http://localhost:9200 >/dev/null || exit 1] interval: 1m @@ -37,6 +37,7 @@ services: env_file: [.env] ports: [5432:5432] volumes: [pgdata:/var/lib/postgresql/data] + networks: [default, db_network] healthcheck: test: [CMD, pg_isready, -U, postgres] interval: 1m @@ -44,7 +45,6 @@ services: retries: 5 start_period: 1m restart: unless-stopped - networks: [default, db_network] api: build: context: . @@ -60,10 +60,11 @@ services: memory: 4G env_file: [.env] command: [poetry, run, /app/start-server-dev.sh] - volumes: [.:/app, $HOME/.basedosdados/credentials:/app/credentials:ro] ports: - 8080:80 # API port - 5678:5678 # Debug port + volumes: [.:/app, $HOME/.basedosdados/credentials:/app/credentials:ro] + networks: [default, db_network] depends_on: index: condition: service_healthy