first commit
This commit is contained in:
29
config.py
Normal file
29
config.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import os
|
||||
|
||||
def load_config(mode=os.environ.get('MODE')):
|
||||
"""
|
||||
Load application configuration from environment variables.
|
||||
The MODE environment variable determines which default CORS origins to use,
|
||||
but all secrets are loaded from environment variables.
|
||||
"""
|
||||
from settings import ApplicationConfig
|
||||
|
||||
print(f"Mode is {mode or 'not set (defaulting to DEVELOPMENT)'}")
|
||||
|
||||
# Validate required configuration
|
||||
try:
|
||||
ApplicationConfig.validate_required()
|
||||
except ValueError as e:
|
||||
print(f"\033[91mConfiguration Error: {e}\033[0m")
|
||||
raise
|
||||
|
||||
# Print appropriate warning based on database
|
||||
if ApplicationConfig.POSTGRES_DBNAME00 == 'eamco':
|
||||
print("\033[92mTest database confirmed\033[0m")
|
||||
else:
|
||||
print("\033[91mPRODUCTION DATABASE\033[0m")
|
||||
|
||||
if mode == 'PRODUCTION':
|
||||
print("\033[91mPRODUCTION MODE\033[0m")
|
||||
|
||||
return ApplicationConfig
|
||||
Reference in New Issue
Block a user