# Configuration file for this FastAPI app. import os from pydantic import AnyHttpUrl, BaseSettings, EmailStr, HttpUrl, PostgresDsn, validator from typing import Any, Dict, List, Optional, Union # ### ### # class Settings(BaseSettings): AETHER_CFG = {} 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 = 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' # Database Connection DB = {} DB['server'] = os.getenv('AE_DB_SERVER', 'mariadb') # 'linode.oneskyit.com' # linode.oneskyit.com, vpn-linode linode.oneskyit.local DB['port'] = os.getenv('AE_DB_PORT', '3306') # default = 3306 DB['name'] = os.getenv('AE_DB_NAME', None) # 'aether_dev' #onesky_ams_dev DB['username'] = os.getenv('AE_DB_USERNAME', None) # 'osit_aether' # 'onesky_aether' DB['password'] = os.getenv('AE_DB_PASSWORD', None) # SQLALCHEMY_DB_URI = 'mysql://'+DB['username']+':'+DB['password']+'@'+DB['server']+'/'+DB['name'] # DB['wait_timeout'] = int(os.getenv('AE_DB_WAIT_TIMEOUT', 1800)) # Not used yet! default = 28800; Time (seconds) that the server waits for a connection to become active before closing it. DB['connect_timeout'] = int(os.getenv('AE_DB_CONNECTION_TIMEOUT', 20)) # default = 10; Time (seconds) that the server waits for a connection to become active before closing it. DB['pool_recycle'] = int(os.getenv('AE_DB_POOL_RECYCLE', 1800)) # default = ?; Related to SQLAlchemy # Aether API log files paths LOG_PATH = {} LOG_PATH['app'] = os.getenv('AE_API_LOG_PATH', 'admin/log/app.log') # 'admin/log/app.log', '../../logs/aether_api.log' # LOG_PATH['app_warning'] = '/logs/aether_api_warning.log' # 'admin/log/app_warning.log' '../../logs/aether_api_warning.log' # Redis REDIS = {} REDIS['server'] = os.getenv('AE_REDIS_SERVER', 'redis') # 'localhost' 'redis' REDIS['port'] = os.getenv('AE_REDIS_PORT', '6379') # '6379' # Send SMTP Email SMTP = {} # server # port # username # password # Server Hosted File Paths FILES_PATH = {} # hosted_files_root # hosted_tmp_root # CORS Origins ORIGINS_REGEX = os.getenv('AE_API_ORIGINS_REGEX', '(https://.*\.oneskyit\.com)|(https://.*\.oneskyit\.com:4443)|(https://.*\.oneskyit\.com:8443)') # '(https://.*\.oneskyit\.com)|(http://.*\.oneskyit\.com)|(https://.*\.oneskyit\.com:4443)|(http://.*\.oneskyit\.com:8080)|(http://.*\.oneskyit\.com:8181)|(https://.*\.oneskyit\.com:8443)|(http://.*\.oneskyit\.local)|(http://.*\.oneskyit\.local:5000)|(http://.*.localhost)|(http://.*.localhost:5000)|(http://.*.localhost:8181)' # A reasonable, but fairly open example regular expression for the CORS origins: # '(https://.*\.oneskyit\.com)|(http://.*\.oneskyit\.com)|(http://.*\.oneskyit\.com:8181)|(https://.*\.oneskyit\.com:8443)|(http://.*\.oneskyit\.local)|(http://.*\.oneskyit\.local:5000)|(http://.*.localhost)|(http://.*.localhost:5000)|(http://.*.localhost:8181)' ORIGINS = [ 'https://oneskyit.com', # 'http://app-local.oneskyit.com', # 'http://192.168.32.20:3000', # 'http://192.168.32.20:8080', # 'http://localhost', # 'http://localhost:3000', # 'http://localhost:5000', # 'http://localhost:7800', # 'http://localhost:8080', # 'http://localhost:8888', # 'http://fastapi.localhost', # 'http://svelte.oneskyit.local:5555', # 'http://connect.localhost:5000', # Using localhost # 'http://dev-svelte.oneskyit.local:5555', # 'http://lci.internal:5000', # Using internal; just in case guess before LCI # 'http://lci.oneskyit.internal:5000', # Using internal; just in case guess before LCI # 'http://lci.oneskyit.internal', # Using internal; just in case guess before LCI ] settings = Settings()