mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-11 14:00:29 +00:00
fix: restore environment variable support for key settings
- Re-enable DISCOVERY_SUBNET env var for Docker network configuration - Re-enable LOG_LEVEL env var for runtime logging control - Re-enable CONNECTION_TIMEOUT env var for timeout configuration - Re-enable ALLOWED_ORIGINS env var for CORS configuration - Update documentation to reflect working env vars These env vars were accidentally disabled but are useful for Docker deployments. Env vars override system.json settings when present. Addresses #214 - user requested DISCOVERY_SUBNET env var support
This commit is contained in:
@@ -128,16 +128,9 @@ services:
|
||||
# RIGHT: PULSE_AUTH_PASS='$$2a$$12$$hash...'
|
||||
# Or use a .env file where no escaping is needed
|
||||
|
||||
# Polling & timeouts
|
||||
# - POLLING_INTERVAL=10 # Fixed at 10 seconds (matches Proxmox update cycle)
|
||||
# Performance
|
||||
# - CONNECTION_TIMEOUT=10 # Connection timeout in seconds (default: 10)
|
||||
|
||||
# Updates
|
||||
# - UPDATE_CHANNEL=stable # Update channel: stable or rc (default: stable)
|
||||
# - AUTO_UPDATE_ENABLED=false # Enable auto-updates (default: false)
|
||||
# - AUTO_UPDATE_CHECK_INTERVAL=24 # Hours between update checks (default: 24)
|
||||
# - AUTO_UPDATE_TIME=03:00 # Time to install updates HH:MM (default: 03:00)
|
||||
|
||||
# CORS & logging
|
||||
# - ALLOWED_ORIGINS=https://app.example.com # CORS origins (default: none, same-origin only)
|
||||
# - LOG_LEVEL=info # Log level: debug/info/warn/error (default: info)
|
||||
|
||||
+2
-2
@@ -219,12 +219,12 @@ Common problems:
|
||||
| `PORT` | Web UI port | `7655` |
|
||||
| `ALLOWED_ORIGINS` | CORS origins | Same-origin only |
|
||||
| `DISCOVERY_SUBNET` | Network to scan | Auto-detect |
|
||||
| `CONNECTION_TIMEOUT` | Connection timeout (seconds) | `10` |
|
||||
| `LOG_LEVEL` | Logging verbosity | `info` |
|
||||
|
||||
### System
|
||||
| Variable | Description | Default |
|
||||
|----------|-------------|---------|
|
||||
| `POLLING_INTERVAL` | Check interval (seconds) | `10` |
|
||||
| `LOG_LEVEL` | Logging verbosity | `INFO` |
|
||||
| `TZ` | Timezone | `UTC` |
|
||||
|
||||
## Advanced Configuration
|
||||
|
||||
@@ -385,8 +385,28 @@ func Load() (*Config, error) {
|
||||
log.Info().Msg("Development mode: allowing localhost origins")
|
||||
}
|
||||
}
|
||||
// REMOVED: LOG_LEVEL and DISCOVERY_SUBNET env vars
|
||||
// These settings now ONLY come from system.json to prevent confusion
|
||||
// Support env vars for important settings (override system.json)
|
||||
if discoverySubnet := os.Getenv("DISCOVERY_SUBNET"); discoverySubnet != "" {
|
||||
cfg.DiscoverySubnet = discoverySubnet
|
||||
log.Info().Str("subnet", discoverySubnet).Msg("Discovery subnet set from DISCOVERY_SUBNET env var")
|
||||
}
|
||||
if logLevel := os.Getenv("LOG_LEVEL"); logLevel != "" {
|
||||
cfg.LogLevel = logLevel
|
||||
log.Info().Str("level", logLevel).Msg("Log level set from LOG_LEVEL env var")
|
||||
}
|
||||
if connectionTimeout := os.Getenv("CONNECTION_TIMEOUT"); connectionTimeout != "" {
|
||||
if d, err := time.ParseDuration(connectionTimeout + "s"); err == nil {
|
||||
cfg.ConnectionTimeout = d
|
||||
log.Info().Dur("timeout", d).Msg("Connection timeout set from CONNECTION_TIMEOUT env var")
|
||||
} else if d, err := time.ParseDuration(connectionTimeout); err == nil {
|
||||
cfg.ConnectionTimeout = d
|
||||
log.Info().Dur("timeout", d).Msg("Connection timeout set from CONNECTION_TIMEOUT env var")
|
||||
}
|
||||
}
|
||||
if allowedOrigins := os.Getenv("ALLOWED_ORIGINS"); allowedOrigins != "" {
|
||||
cfg.AllowedOrigins = allowedOrigins
|
||||
log.Info().Str("origins", allowedOrigins).Msg("Allowed origins set from ALLOWED_ORIGINS env var")
|
||||
}
|
||||
|
||||
// Set log level
|
||||
switch cfg.LogLevel {
|
||||
|
||||
Reference in New Issue
Block a user