mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-11 14:00:29 +00:00
docs: clarify environment variable precedence behavior
- Add clear warnings that env vars override UI/system.json settings - Update log messages to indicate when env vars are overriding values - Document standard container practice: env vars have highest precedence - Users must remove env vars to allow UI configuration to take effect This prevents confusion when UI changes don't work due to env var overrides.
This commit is contained in:
@@ -109,6 +109,8 @@ services:
|
||||
volumes:
|
||||
- pulse_data:/data
|
||||
environment:
|
||||
# NOTE: Env vars override UI settings. Remove env var to allow UI configuration.
|
||||
|
||||
# Network discovery
|
||||
# - DISCOVERY_SUBNET=192.168.1.0/24 # Your local subnet (default: auto-detect)
|
||||
|
||||
|
||||
@@ -206,6 +206,8 @@ Common problems:
|
||||
|
||||
## Environment Variables Reference
|
||||
|
||||
> **⚠️ Important**: Environment variables always override UI/system.json settings. If you set a value via env var (e.g., `DISCOVERY_SUBNET`), changes made in the UI for that setting will NOT take effect until you remove the env var. This follows standard container practices where env vars have highest precedence.
|
||||
|
||||
### Authentication
|
||||
| Variable | Description | Example |
|
||||
|----------|-------------|---------|
|
||||
|
||||
@@ -386,26 +386,27 @@ func Load() (*Config, error) {
|
||||
}
|
||||
}
|
||||
// Support env vars for important settings (override system.json)
|
||||
// NOTE: Environment variables always take precedence over UI/system.json settings
|
||||
if discoverySubnet := os.Getenv("DISCOVERY_SUBNET"); discoverySubnet != "" {
|
||||
cfg.DiscoverySubnet = discoverySubnet
|
||||
log.Info().Str("subnet", discoverySubnet).Msg("Discovery subnet set from DISCOVERY_SUBNET env var")
|
||||
log.Info().Str("subnet", discoverySubnet).Msg("Discovery subnet overridden by 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")
|
||||
log.Info().Str("level", logLevel).Msg("Log level overridden by 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")
|
||||
log.Info().Dur("timeout", d).Msg("Connection timeout overridden by 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")
|
||||
log.Info().Dur("timeout", d).Msg("Connection timeout overridden by 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")
|
||||
log.Info().Str("origins", allowedOrigins).Msg("Allowed origins overridden by ALLOWED_ORIGINS env var")
|
||||
}
|
||||
|
||||
// Set log level
|
||||
|
||||
Reference in New Issue
Block a user