diff --git a/.gitignore b/.gitignore index 3e102dc..56465c8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ /filecache /__pycache__ /access_log.db -/folder_config.json \ No newline at end of file +/folder_config.json +/.env \ No newline at end of file diff --git a/app.py b/app.py index d3da61f..326aa35 100755 --- a/app.py +++ b/app.py @@ -377,7 +377,9 @@ def handle_request_initial_data(): @app.route('/') @auth.require_secret def index(path): - return render_template("app.html") + title_short = os.environ.get('TITLE_SHORT', 'Default Title') + title_long = os.environ.get('TITLE_LONG', 'Default Title') + return render_template("app.html", title_short=title_short, title_long=title_long) if __name__ == '__main__': socketio.run(app, debug=True, host='0.0.0.0') diff --git a/docker-compose.yml b/docker-compose.yml index b1a0c62..b7c98ee 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ services: flask-app: image: python:3.11-slim - container_name: bethaus-app + container_name: "${CONTAINER_NAME}" restart: always working_dir: /app volumes: @@ -17,25 +17,27 @@ services: environment: - FLASK_APP=app.py - FLASK_ENV=production + - TITLE_SHORT=${TITLE_SHORT} + - TITLE_LONG=${TITLE_LONG} networks: - traefik labels: - "traefik.enable=true" # HTTP router (port 80), redirecting to HTTPS - - "traefik.http.routers.bethaus-app.rule=Host(`app.bethaus-speyer.de`)" - - "traefik.http.routers.bethaus-app.entrypoints=web" - - "traefik.http.routers.bethaus-app.middlewares=redirect-to-https" + - "traefik.http.routers.${CONTAINER_NAME}.rule=${HOST_RULE}" + - "traefik.http.routers.${CONTAINER_NAME}.entrypoints=web" + - "traefik.http.routers.${CONTAINER_NAME}.middlewares=redirect-to-https" - "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https" # HTTPS router (TLS via Let's Encrypt) - - "traefik.http.routers.bethaus-app-secure.rule=Host(`app.bethaus-speyer.de`)" - - "traefik.http.routers.bethaus-app-secure.entrypoints=websecure" - - "traefik.http.routers.bethaus-app-secure.tls=true" - - "traefik.http.routers.bethaus-app-secure.tls.certresolver=myresolver" + - "traefik.http.routers.${CONTAINER_NAME}-secure.rule=${HOST_RULE}" + - "traefik.http.routers.${CONTAINER_NAME}-secure.entrypoints=websecure" + - "traefik.http.routers.${CONTAINER_NAME}-secure.tls=true" + - "traefik.http.routers.${CONTAINER_NAME}-secure.tls.certresolver=myresolver" # Internal port - - "traefik.http.services.bethaus-app.loadbalancer.server.port=5000" + - "traefik.http.services.${CONTAINER_NAME}.loadbalancer.server.port=5000" # Production-ready Gunicorn command with eventlet command: > diff --git a/templates/app.html b/templates/app.html index 52ab32d..6e81a17 100644 --- a/templates/app.html +++ b/templates/app.html @@ -8,7 +8,7 @@ - Gottesdienste + {{ title_short }} @@ -38,7 +38,7 @@ -

Gottesdienste Speyer und Schwegenheim

+

{{ title_long }}