Better configs with environment vars

This commit is contained in:
Scott Idem
2023-09-08 14:01:00 -04:00
parent cccf9fd24f
commit be1bb21b7e
3 changed files with 7 additions and 5 deletions

View File

@@ -96,7 +96,7 @@ AE_API_LOG_PATH="/logs/aether_api.log"
AE_API_WORKERS=2
AE_API_THREADS=1
AE_API_RELOAD=False
AE_API_JWT_KEY="ABC123 22 CHARS" # 22 characters; super secret Aether JWT signing key
# Aether app specific config (Flask with Svelte)
AE_APP_CFG_ID=0
@@ -111,3 +111,5 @@ AE_APP_THREADS=1
AE_APP_RELOAD=True
# Generate a new key with: # python -c 'import os; print(os.urandom(16))'
AE_APP_CACHE_SECRET_KEY="$\x93\x12\xb4R\x80R\xb5\xe50\xa0k\xc8#RN"
AE_APP_SESSION_LIFETIME=86400 # How long the browser cookies last in seconds (default=86400)
AE_APP_CACHE_TIMEOUT=5 # How long the Flask app caching last in seconds (default=5)

View File

@@ -12,7 +12,7 @@ class Settings(BaseSettings):
AETHER_CFG['id'] = os.getenv('AE_CFG_ID', None)
# AETHER_CFG['api_id'] = os.getenv('AE_API_CFG_ID', None) # NOT CURRENTLY NEED OR USED
JWT_KEY = 'EHmSXZFKfMEW65E8kxCKmQ' # 22 characters; super secret Aether JWT signing key
JWT_KEY = os.getenv('AE_API_JWT_KEY', '22 chars 00xXyYzZ99') # 22 characters; super secret Aether JWT signing key
# APP_NAME: str = "Aether API (FastAPI)"
# SUPER_EMAIL: EmailStr = 'Aether.Super@oneskyit.com'

View File

@@ -31,7 +31,7 @@ SECRET_KEY = os.getenv('AE_APP_CACHE_SECRET_KEY', None) # Generate a new key wit
# 7862400 is 91 days or 13 weeks (.25 year)
# 31536000 is 365 days
# 33868800 is 9408 hours or 392 days
PERMANENT_SESSION_LIFETIME = 3600
PERMANENT_SESSION_LIFETIME = int(os.getenv('AE_APP_SESSION_LIFETIME', 86400))
SESSION_REFRESH_EACH_REQUEST = True
# Files and caching
@@ -43,7 +43,7 @@ SESSION_REFRESH_EACH_REQUEST = True
SEND_FILE_MAX_AGE_DEFAULT = 3 # default 43200 (in seconds), 1800 = 30 minutes
CACHE_TYPE = 'SimpleCache'
CACHE_DEFAULT_TIMEOUT = 1
CACHE_DEFAULT_TIMEOUT = int(os.getenv('AE_APP_CACHE_TIMEOUT', 5))
JSONIFY_PRETTYPRINT_REGULAR = True