04/08 Refactored codes, fixed issues
This commit is contained in:
@@ -33,6 +33,16 @@ class Config:
|
||||
)
|
||||
DEBUG = os.environ.get('DEBUG', 'False').lower() == 'true'
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
# SQLAlchemy connection pool (read from .env; safe defaults)
|
||||
# ------------------------------------------------------------------ #
|
||||
SQLALCHEMY_ENGINE_OPTIONS = {
|
||||
'pool_size': int(os.environ.get('SQLALCHEMY_ENGINE_OPTIONS_POOL_SIZE', '10')),
|
||||
'pool_timeout': int(os.environ.get('SQLALCHEMY_ENGINE_OPTIONS_POOL_TIMEOUT', '20')),
|
||||
'pool_recycle': int(os.environ.get('SQLALCHEMY_ENGINE_OPTIONS_POOL_RECYCLE', '3600')),
|
||||
'max_overflow': int(os.environ.get('SQLALCHEMY_ENGINE_OPTIONS_MAX_OVERFLOW', '20')),
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
# Session / cookies
|
||||
# ------------------------------------------------------------------ #
|
||||
@@ -107,4 +117,4 @@ _config_map = {
|
||||
def get_config():
|
||||
"""Return the active Config class based on FLASK_ENV."""
|
||||
env = os.environ.get('FLASK_ENV', 'default').lower()
|
||||
return _config_map.get(env, Config)
|
||||
return _config_map.get(env, Config)
|
||||
Reference in New Issue
Block a user