From d3f310a48cc4d21ee4c197272510c88156d890bb Mon Sep 17 00:00:00 2001 From: Norbert Szulc Date: Thu, 11 Jul 2024 01:47:32 +0200 Subject: [PATCH] feat: IP mask from env --- docker-compose.yml | 9 +++++++++ whois/settings.py | 5 ++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2898108..a903f73 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,7 @@ services: environment: # you should change secret key - SECRET_KEY=example123 + - APP_IP_MASK=172.18.0.1 - APP_DB_DIALECT=postgresql - APP_DB_NAME=whohacks - APP_DB_USER=whohacks @@ -19,11 +20,14 @@ services: ports: # use 127.0.0.1:8000:8000 - "8000:8000" + # network_mode: "host" volumes: - sqlite:/data - /etc/localtime:/etc/localtime:ro depends_on: - postgres + networks: + - default postgres: image: postgres:latest @@ -36,6 +40,9 @@ services: - POSTGRES_PASSWORD=S3cret - POSTGRES_USER=whohacks - POSTGRES_DB=whohacks + networks: + - default + mock-oauth2-server: image: ghcr.io/navikt/mock-oauth2-server:2.1.8 hostname: oauth.localhost @@ -52,6 +59,8 @@ services: SERVER_PORT: 8080 # SERVER_HOSTNAME: localhost JSON_CONFIG_PATH: /app/config.json + networks: + - default volumes: sqlite: diff --git a/whois/settings.py b/whois/settings.py index f993b4f..92680f3 100644 --- a/whois/settings.py +++ b/whois/settings.py @@ -42,6 +42,5 @@ APP_OAUTH_OPENID = os.environ.get("APP_OAUTH_OPENID") # production -ip_mask = "192.168.88.1-255" -# TODO: better way for handling dev env -# ip_mask = "127.0.0.1" +# ip_mask = "192.168.88.1-255" +ip_mask = os.environ.get("APP_IP_MASK") \ No newline at end of file