diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index bedf0db..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.env.example b/.env.example index 91cf018..dba611d 100644 --- a/.env.example +++ b/.env.example @@ -1,26 +1,73 @@ # .env.example - Template for environment variables # Copy to .env and customize -SECRET_KEY=change-me +# ============================================================================ +# General +# ============================================================================ +# SECRET_KEY - Secret key for web application session signing and +# security features. Use a long random string in production. +SECRET_KEY=dev-secret-key-change-in-production +# ============================================================================ # GPON Device +# ============================================================================ +# GPON_HOST - IP address or hostname of the GPON ONU/ONT device +# GPON_PORT - Management port (Telnet/SSH) for device connection +# GPON_USERNAME - Username for GPON device authentication +# GPON_PASSWORD - Password for GPON device authentication GPON_HOST=192.168.100.1 GPON_PORT=23 GPON_USERNAME=leox GPON_PASSWORD=leolabs_7 +# ============================================================================ # Web Server +# ============================================================================ +# LISTEN_HOST - IP address the web server binds to (0.0.0.0 = all interfaces) +# !! DO NOT CHANGE IN DOCKER - must be 0.0.0.0 for container networking +# LISTEN_PORT - Internal port used by the web application (default: 8080) +# !! If changed, also update 'expose' section in docker-compose.yml +# EXTERNAL_PORT - Port exposed externally via Caddy reverse proxy (default: 7878) +# Change this to expose the app on different host port LISTEN_HOST=0.0.0.0 LISTEN_PORT=8080 EXTERNAL_PORT=7878 -# Data +# ============================================================================ +# Data & Polling +# ============================================================================ +# RRD_DIR - Filesystem path where RRD databases are stored +# !! DO NOT CHANGE IN DOCKER - must be /data/rrd (mapped to ./data/rrd volume) +# POLL_INTERVAL - Data collection interval in seconds (how often device is polled) RRD_DIR=/data/rrd POLL_INTERVAL=60 -# Thresholds +# ============================================================================ +# Optical & Temperature Thresholds +# ============================================================================ +# RX_POWER_MIN - Minimum acceptable RX optical power in dBm (warning below) +# RX_POWER_MAX - Maximum acceptable RX optical power in dBm (warning above) +# TX_POWER_MIN - Minimum acceptable TX optical power in dBm +# TX_POWER_MAX - Maximum acceptable TX optical power in dBm +# TEMPERATURE_MAX - Maximum module temperature in °C before alert RX_POWER_MIN=-28.0 RX_POWER_MAX=-8.0 TX_POWER_MIN=0.5 TX_POWER_MAX=4.0 TEMPERATURE_MAX=85.0 + +# ============================================================================ +# Laser Bias Current Thresholds (TX Bias) +# ============================================================================ +# TX_BIAS_MIN - Minimum TX bias current in mA (below = weak/failing laser) +# TX_BIAS_MAX - Maximum TX bias current in mA (above = laser aging/overheating) +TX_BIAS_MIN=5.0 +TX_BIAS_MAX=90.0 + +# ============================================================================ +# Supply Voltage Thresholds +# ============================================================================ +# VOLTAGE_MIN - Minimum supply voltage in volts (below = unstable power) +# VOLTAGE_MAX - Maximum supply voltage in volts (above = risk of damage) +VOLTAGE_MIN=3.0 +VOLTAGE_MAX=3.6 diff --git a/README.md b/README.md index 88aa232..a244887 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ GPON_HOST=192.168.100.1 GPON_USERNAME=leox GPON_PASSWORD=leolabs_7 EXTERNAL_PORT=8080 + +[...] ``` ### 3. Start the container diff --git a/config.py b/config.py index f92b922..950b732 100644 --- a/config.py +++ b/config.py @@ -26,6 +26,10 @@ class Config: '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