From b21fed388e40e8c51026bb120923070873270473 Mon Sep 17 00:00:00 2001 From: sin Date: Tue, 25 Mar 2025 16:59:08 +0000 Subject: [PATCH] Updated environmental variables as well as the HTML templates. This allows users to set names and roles so this can be quickly deployed multiple times. --- .gitignore | 1 + Dockerfile | 4 +++- app.py | 27 +++++++++++++++++++++++---- package.json | 1 + requirements.txt | 2 ++ 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index de9d7c8..0047632 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .env list.txt +__pycache__/ diff --git a/Dockerfile b/Dockerfile index f5aa291..8cfc9ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,9 @@ RUN pip install --no-cache-dir -r requirements.txt EXPOSE 5000 # Define environment variable -ENV NAME World +ENV NAME=World +ENV FLASK_DEBUG=true # Run app.py when the container launches CMD ["python3", "app.py"] + diff --git a/app.py b/app.py index f122bed..0dea1e2 100644 --- a/app.py +++ b/app.py @@ -1,14 +1,22 @@ from flask import Flask, render_template_string, request +from werkzeug.middleware.proxy_fix import ProxyFix +import os app = Flask(__name__) +USER1 = os.environ.get("USER1") +ROLE1 = os.environ.get("ROLE1") +USER2 = os.environ.get("USER2") +ROLE2 = os.environ.get("ROLE2") +DOCUMENTTYPE = os.environ.get("DOCUMENTTYPE") + # Define the HTML template for the list HTML_TEMPLATE = ''' - Chris/Alice Master/Kitten Contract (Read Only) + ''' + str(USER1) + " and " + str(USER2) + " " + str(ROLE1) + " and " + str(ROLE2) + " " + DOCUMENTTYPE + ''' -

Chris/Alice Master/Kitten Contract (Read Only)

+
+

''' + str(ROLE1) + " " + str(USER1) + '''

+

''' + str(ROLE2) + " " + str(USER2) + '''

+

''' + str(DOCUMENTTYPE) + '''