Files
leox-gpon-monitoring/config.py
Mateusz Gruszczyński 69711b46bc release
2026-01-02 22:31:35 +01:00

34 lines
1.1 KiB
Python

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)),
}
# Web Interface
LISTEN_HOST = os.getenv('LISTEN_HOST', '0.0.0.0')
LISTEN_PORT = int(os.getenv('LISTEN_PORT', 8080))