diff --git a/src/application.py b/src/application.py index f00d8e6..f8d01ec 100644 --- a/src/application.py +++ b/src/application.py @@ -19,9 +19,10 @@ from src.config import config from src.models import db from src.views.errors import error_pages from src.views.scoreboard import scoreboard -from src.resources.utilities import cache, get_env_variable +from src.resources.utilities import cache import flask_bootstrap import flask +import os def create_app(config_name): @@ -37,11 +38,10 @@ def create_app(config_name): return app -configuration = get_env_variable("BSFLASK_ENV", fallback="default") +configuration = os.environ.get("BSFLASK_ENV", "default") app = create_app(configuration) print("Running with", configuration, "configuration setting.") - if __name__ == "__main__": app.run(app.config["BIND_IP"], app.config["BIND_PORT"]) diff --git a/src/config.py b/src/config.py index b860e81..9bea94a 100644 --- a/src/config.py +++ b/src/config.py @@ -17,7 +17,6 @@ """ import os from src.models import db -from src.resources.utilities import get_env_variable basedir = os.path.abspath(os.path.dirname(__file__)) @@ -62,10 +61,10 @@ class ProductionConfig(Config): BOOTSTRAP_USE_MINIFIED = True DEBUG = False # Database Configuration - MYSQL_USERNAME = get_env_variable("BSFLASK_MYSQL_USERNAME", fallback=None) - MYSQL_PASSWORD = get_env_variable("BSFLASK_MYSQL_PASSWORD", fallback=None) - MYSQL_HOSTNAME = get_env_variable("BSFLASK_MYSQL_HOSTNAME", fallback=None) - MYSQL_DATABASE = get_env_variable("BSFLASK_MYSQL_DATABASE", fallback=None) + MYSQL_USERNAME = os.environ.get("BSFLASK_MYSQL_USERNAME", None) + MYSQL_PASSWORD = os.environ.get("BSFLASK_MYSQL_PASSWORD", None) + MYSQL_HOSTNAME = os.environ.get("BSFLASK_MYSQL_HOSTNAME", None) + MYSQL_DATABASE = os.environ.get("BSFLASK_MYSQL_DATABASE", None) SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://{username}:{password}@{hostname}/{database}'\ .format(username=MYSQL_USERNAME, password=MYSQL_PASSWORD, hostname=MYSQL_HOSTNAME, database=MYSQL_DATABASE)