from os import getenv import json def build_postgres_config(): return { 'host': getenv('POSTGRES_HOST', 'localhost'), 'port': int(getenv('POSTGRES_PORT', '5432')), 'user': getenv('POSTGRES_USER', 'sientia'), 'password': getenv('POSTGRES_PASSWORD', 'sientia'), 'dbname': getenv('POSTGRES_DBNAME', 'sientia'), 'min_connections': int(getenv('POSTGRES_MIN_CONNECTIONS', '5')), 'max_connections': int(getenv('POSTGRES_MAX_CONNECTIONS', '20')) } def build_mlflow_config(): return { 'host': getenv('MLFLOW_HOST', 'http://localhost'), 'port': int(getenv('MLFLOW_PORT', '5080')), 'username': getenv('MLFLOW_USERNAME', 'aignosi'), 'password': getenv('MLFLOW_PASSWORD', 'aignosi') } def build_opc_config(): opc_raw = getenv('OPC_CONFIG', None) if opc_raw: return json.loads(opc_raw) return { 'opc': { 'name': getenv('OPC_NAME', 'opc'), 'url': getenv('OPC_URL', 'opc.tcp://localhost:4840'), 'server_uri': getenv('OPC_SERVER_URI', 'opc.tcp://localhost:4840'), 'cert_path': getenv('OPC_CERT_PATH', None), 'private_key_path': getenv('OPC_PRIVATE_KEY_PATH', None), 'server_cert_path': getenv('OPC_SERVER_CERT_PATH', None), 'reconnection_interval': int(getenv('OPC_RECONNECTION_INTERVAL', '120')) } }