CHORE: Created .env file to store environment vars
This commit is contained in:
parent
01cf5d641b
commit
dba4cf01a3
@ -54,8 +54,6 @@ services:
|
||||
container_name: "wmgzon"
|
||||
image: lukeelse/wmgzon:latest
|
||||
environment:
|
||||
- APPSECRET=test
|
||||
- ENVIRON=prod
|
||||
- FILESTORE=static/assets/img/products/
|
||||
tty: true
|
||||
ports:
|
||||
|
2
app.py
2
app.py
@ -1,5 +1,6 @@
|
||||
from flask import Flask
|
||||
from os import environ
|
||||
from dotenv import load_dotenv
|
||||
from controllers.web.endpoints import blueprint
|
||||
|
||||
'''
|
||||
@ -11,6 +12,7 @@ from controllers.web.endpoints import blueprint
|
||||
app: Flask = Flask(__name__)
|
||||
|
||||
# Set app secret key to sign session cookies
|
||||
load_dotenv()
|
||||
secret_key = environ.get("APPSECRET")
|
||||
if secret_key is None:
|
||||
# NO Secret Key set!
|
||||
|
12
cicd/Deployment/docker-compose.yml
Normal file
12
cicd/Deployment/docker-compose.yml
Normal file
@ -0,0 +1,12 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
wmgzon:
|
||||
container_name: "wmgzon"
|
||||
image: lukeelse/wmgzon:latest
|
||||
tty: true
|
||||
ports:
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
- ./files:/app/static/assets/img/products/
|
||||
restart: unless-stopped
|
@ -5,14 +5,12 @@ services:
|
||||
container_name: "wmgzon"
|
||||
build: .
|
||||
environment:
|
||||
- APPSECRET=test
|
||||
- ENVIRON=test
|
||||
#- ENVIRON=prod
|
||||
- FILESTORE=static/assets/img/products/
|
||||
tty: true
|
||||
ports:
|
||||
- "8080:8080"
|
||||
# Dev container -> Copies complete root directory with latest
|
||||
# code into the container
|
||||
volumes:
|
||||
- .:/app
|
||||
restart: unless-stopped
|
||||
|
@ -24,3 +24,4 @@ virtualenv==20.24.6
|
||||
waitress==2.1.2
|
||||
Werkzeug==3.0.1
|
||||
pycodestyle==2.11.1
|
||||
python-dotenv==1.0.1
|
@ -2,11 +2,16 @@
|
||||
pytest --disable-warnings
|
||||
python ./scripts/create_database.py
|
||||
|
||||
|
||||
EXPECTED_VALUE="test"
|
||||
|
||||
if [ -z "$ENVIRON" ]; then
|
||||
echo "ENVIRON is not set."
|
||||
else
|
||||
echo "Using DEFAULT Environ Value: prod"
|
||||
|
||||
export ENVIRON=prod
|
||||
fi
|
||||
|
||||
echo "ENVIRON is set to: $ENVIRON"
|
||||
|
||||
# Trim leading and trailing whitespaces
|
||||
@ -19,6 +24,3 @@ else
|
||||
echo "Launching PROD Server"
|
||||
waitress-serve --host 0.0.0.0 app:app
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Setup test environment variables
|
||||
load_dotenv()
|
||||
|
||||
# Capture environment variables at start of testing so we can
|
||||
# Monitor current setting during tests
|
||||
|
Loading…
Reference in New Issue
Block a user