diff --git a/app.py b/app.py index d78c895..680467e 100644 --- a/app.py +++ b/app.py @@ -127,6 +127,7 @@ AUTH_COOKIE_MAX_AGE = app.config.get("AUTH_COOKIE_MAX_AGE") HEALTHCHECK_TOKEN = app.config.get("HEALTHCHECK_TOKEN") SESSION_TIMEOUT_MINUTES = int(app.config.get("SESSION_TIMEOUT_MINUTES")) SESSION_COOKIE_SECURE = app.config.get("SESSION_COOKIE_SECURE") +APP_PORT = int(app.config.get("APP_PORT")) app.config["COMPRESS_ALGORITHM"] = ["zstd", "br", "gzip", "deflate"] app.config["PERMANENT_SESSION_LIFETIME"] = timedelta(minutes=SESSION_TIMEOUT_MINUTES) @@ -4053,4 +4054,4 @@ def create_db(): if __name__ == "__main__": logging.basicConfig(level=logging.DEBUG if DEBUG_MODE else logging.INFO) - socketio.run(app, host="0.0.0.0", port=8000, debug=False) + socketio.run(app, host="0.0.0.0", port = APP_PORT, debug=False) diff --git a/config.py b/config.py index 10d398a..8628cf2 100644 --- a/config.py +++ b/config.py @@ -10,6 +10,8 @@ class Config: SECRET_KEY = os.environ.get("SECRET_KEY", "D8pceNZ8q%YR7^7F&9wAC2") + APP_PORT = int(os.environ.get("APP_PORT", "8000") or "8000") + DB_ENGINE = os.environ.get("DB_ENGINE", "sqlite").lower() if DB_ENGINE == "sqlite": SQLALCHEMY_DATABASE_URI = ( diff --git a/docker-compose.yml b/docker-compose.yml index 565a5fd..ee90856 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,9 +5,9 @@ services: #ports: # - "${APP_PORT:-8000}:8000" expose: - - "8000" + - "${APP_PORT:-8000}" healthcheck: - test: ["CMD", "python", "-c", "import urllib.request; import sys; req = urllib.request.Request('http://localhost:8000/healthcheck', headers={'X-Internal-Check': '${HEALTHCHECK_TOKEN}'}); sys.exit(0) if urllib.request.urlopen(req).read() == b'OK' else sys.exit(1)"] + test: ["CMD", "python", "-c", "import urllib.request; import sys; req = urllib.request.Request('http://localhost:${APP_PORT:-8000}/healthcheck', headers={'X-Internal-Check': '${HEALTHCHECK_TOKEN}'}); sys.exit(0) if urllib.request.urlopen(req).read() == b'OK' else sys.exit(1)"] interval: 30s timeout: 10s retries: 3 @@ -27,7 +27,7 @@ services: app: condition: service_healthy ports: - - "${APP_PORT:-8080}:80" + - "${APP_PORT:-8000}:80" volumes: - ./deploy/varnish/default.vcl:/etc/varnish/default.vcl:ro environment: