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 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), diff --git a/compose.yaml b/compose.yaml index f39fa4d7..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 @@ -59,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 @@ -80,3 +82,7 @@ services: volumes: esdata: pgdata: +# External network used for database access by other services (e.g., chatbot API) +networks: + db_network: + name: db_network