import os from pathlib import Path class Config: # Flask SECRET_KEY = os.getenv('SECRET_KEY', 'dev-secret-key-change-in-production') # GPON Device GPON_HOST = os.getenv('GPON_HOST', '192.168.100.1') GPON_PORT = int(os.getenv('GPON_PORT', 23)) GPON_USERNAME = os.getenv('GPON_USERNAME', 'leox') GPON_PASSWORD = os.getenv('GPON_PASSWORD', 'leolabs_7') # Monitoring POLL_INTERVAL = int(os.getenv('POLL_INTERVAL', 60)) # seconds # RRD Database RRD_DIR = Path(os.getenv('RRD_DIR', './data/rrd')) RRD_DIR.mkdir(parents=True, exist_ok=True) # Thresholds THRESHOLDS = { 'rx_power_min': float(os.getenv('RX_POWER_MIN', -28.0)), 'rx_power_max': float(os.getenv('RX_POWER_MAX', -8.0)), 'tx_power_min': float(os.getenv('TX_POWER_MIN', 0.0)), 'tx_power_max': float(os.getenv('TX_POWER_MAX', 5.0)), 'temperature_max': float(os.getenv('TEMPERATURE_MAX', 85.0)), 'fec_errors_max': int(os.getenv('FEC_ERRORS_MAX', 1000)), 'tx_bias_min': float(os.getenv('TX_BIAS_MIN', 5.0)), 'tx_bias_max': float(os.getenv('TX_BIAS_MAX', 90.0)), 'voltage_min': float(os.getenv('VOLTAGE_MIN', 3.0)), 'voltage_max': float(os.getenv('VOLTAGE_MAX', 3.6)), } # Web Interface LISTEN_HOST = os.getenv('LISTEN_HOST', '0.0.0.0') LISTEN_PORT = int(os.getenv('LISTEN_PORT', 8080))