diff --git a/config/default.py b/config/default.py index 06fb2aa1..77a52c66 100644 --- a/config/default.py +++ b/config/default.py @@ -26,10 +26,14 @@ DB_PORT = environ.get('DB_PORT', default="5432") DB_NAME = environ.get('DB_NAME', default="crc_dev") DB_USER = environ.get('DB_USER', default="crc_user") DB_PASSWORD = environ.get('DB_PASSWORD', default="crc_pass") +SQLALCHEMY_ENGINE_OPTIONS = {"pool_pre_ping": True} # May help with some disconnect issues. +SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_DATABASE_URI = environ.get( 'SQLALCHEMY_DATABASE_URI', default="postgresql://%s:%s@%s:%s/%s" % (DB_USER, DB_PASSWORD, DB_HOST, DB_PORT, DB_NAME) ) + + TOKEN_AUTH_TTL_HOURS = float(environ.get('TOKEN_AUTH_TTL_HOURS', default=24)) SECRET_KEY = environ.get('SECRET_KEY', default="Shhhh!!! This is secret! And better darn well not show up in prod.") FRONTEND_AUTH_CALLBACK = environ.get('FRONTEND_AUTH_CALLBACK', default="http://localhost:4200/session") diff --git a/crc/__init__.py b/crc/__init__.py index 5f47838a..4635f245 100644 --- a/crc/__init__.py +++ b/crc/__init__.py @@ -19,7 +19,6 @@ connexion_app = connexion.FlaskApp(__name__) app = connexion_app.app app.config.from_object('config.default') -app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False if "TESTING" in os.environ and os.environ["TESTING"] == "true": app.config.from_object('config.testing') @@ -28,6 +27,7 @@ else: app.config.root_path = app.instance_path app.config.from_pyfile('config.py', silent=True) + db = SQLAlchemy(app) """:type: sqlalchemy.orm.SQLAlchemy"""