Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
refactor: remove deprecated config fields
rcourtman633eea83dba0
diff --git a/internal/api/diagnostics.go b/internal/api/diagnostics.goindex c4817cde00..8a9e8837b5 100644--- a/internal/api/diagnostics.go+++ b/internal/api/diagnostics.go@@ -651,7 +651,7 @@ func buildAPITokenDiagnostic(cfg *config.Config, monitor *monitoring.Monitor) *A}diag := &APITokenDiagnostic{- Enabled: len(cfg.APITokens) > 0,+ Enabled: cfg.APITokenEnabled,TokenCount: len(cfg.APITokens),}@@ -682,7 +682,9 @@ func buildAPITokenDiagnostic(cfg *config.Config, monitor *monitoring.Monitor) *Adiag.RecommendTokenSetup = len(cfg.APITokens) == 0diag.RecommendTokenRotation = envTokens || legacyToken- if diag.RecommendTokenSetup {+ if !cfg.APITokenEnabled && len(cfg.APITokens) > 0 {+ appendNote("API token authentication is currently disabled. Enable it under Settings → Security so agents can use dedicated tokens.")+ } else if diag.RecommendTokenSetup {appendNote("No API tokens are configured. Open Settings → Security to generate dedicated tokens for each automation or agent.")}diff --git a/internal/config/api_tokens.go b/internal/config/api_tokens.goindex 654bbf0f82..ea4c135c04 100644--- a/internal/config/api_tokens.go+++ b/internal/config/api_tokens.go@@ -269,7 +269,6 @@ func (c *Config) SortAPITokens() {if len(c.APITokens) > 0 {c.APIToken = c.APITokens[0].Hash- c.APITokenEnabled = true} else {c.APIToken = ""}diff --git a/internal/config/api_tokens_test.go b/internal/config/api_tokens_test.goindex b8da7695ec..8f1235a439 100644--- a/internal/config/api_tokens_test.go+++ b/internal/config/api_tokens_test.go@@ -1047,16 +1047,12 @@ func TestSortAPITokens(t *testing.T) {if cfg.APIToken != "primary-hash" {t.Errorf("expected APIToken to be set to primary hash, got %q", cfg.APIToken)}- if !cfg.APITokenEnabled {- t.Error("expected APITokenEnabled to be true")- }})t.Run("empty tokens clears APIToken", func(t *testing.T) {cfg := &Config{- APIToken: "old-value",- APITokenEnabled: true,- APITokens: []APITokenRecord{},+ APIToken: "old-value",+ APITokens: []APITokenRecord{},}cfg.SortAPITokens()diff --git a/internal/config/config.go b/internal/config/config.goindex f22ebf6f58..a141080d04 100644--- a/internal/config/config.go+++ b/internal/config/config.go@@ -79,12 +79,10 @@ func IsPasswordHashed(password string) bool {// NOTE: The envconfig tags are legacy and not used - configuration is loaded from encrypted JSON filestype Config struct {// Server settings- BackendHost string `envconfig:"BACKEND_HOST" default:""`- BackendPort int `envconfig:"BACKEND_PORT" default:"3000"`- FrontendHost string `envconfig:"FRONTEND_HOST" default:""`- FrontendPort int `envconfig:"FRONTEND_PORT" default:"7655"`- ConfigPath string `envconfig:"CONFIG_PATH"`- DataPath string `envconfig:"DATA_DIR"`+ BackendPort int+ FrontendPort int `envconfig:"FRONTEND_PORT" default:"7655"`+ ConfigPath string+ DataPath stringAppRoot string `json:"-"` // Root directory of the application (where binary lives)PublicURL string `envconfig:"PULSE_PUBLIC_URL" default:""` // Full URL to access Pulse (e.g., http://192.168.1.100:7655)AgentConnectURL string `envconfig:"PULSE_AGENT_CONNECT_URL" default:""` // Dedicated direct connect URL for agents (e.g. http://192.168.1.5:7655)@@ -99,10 +97,9 @@ type Config struct {PMGInstances []PMGInstance// Monitoring settings- PVEPollingInterval time.Duration `envconfig:"PVE_POLLING_INTERVAL"` // PVE polling interval (10s default)- PBSPollingInterval time.Duration `envconfig:"PBS_POLLING_INTERVAL"` // PBS polling interval (60s default)- PMGPollingInterval time.Duration `envconfig:"PMG_POLLING_INTERVAL"` // PMG polling interval (60s default)- ConcurrentPolling bool `envconfig:"CONCURRENT_POLLING" default:"true"`+ PVEPollingInterval time.Duration `envconfig:"PVE_POLLING_INTERVAL"` // PVE polling interval (10s default)+ PBSPollingInterval time.Duration `envconfig:"PBS_POLLING_INTERVAL"` // PBS polling interval (60s default)+ PMGPollingInterval time.Duration `envconfig:"PMG_POLLING_INTERVAL"` // PMG polling interval (60s default)ConnectionTimeout time.Duration `envconfig:"CONNECTION_TIMEOUT" default:"45s"` // Increased for slow storage operationsBackupPollingCycles int `envconfig:"BACKUP_POLLING_CYCLES" default:"10"`BackupPollingInterval time.Duration `envconfig:"BACKUP_POLLING_INTERVAL"`@@ -138,7 +135,6 @@ type Config struct {// Security settingsAPIToken string `envconfig:"API_TOKEN"`- APITokenEnabled bool `envconfig:"API_TOKEN_ENABLED" default:"false"`APITokens []APITokenRecord `json:"-"`SuppressedEnvMigrations []string `json:"-"` // Hashes of env tokens deleted by user (prevent re-migration)AuthUser string `envconfig:"PULSE_AUTH_USER"`@@ -146,7 +142,6 @@ type Config struct {DisableAuthEnvDetected bool `json:"-"`DemoMode bool `envconfig:"DEMO_MODE" default:"false"` // Read-only demo modeAllowedOrigins string `envconfig:"ALLOWED_ORIGINS" default:"*"`- IframeEmbeddingAllow string `envconfig:"IFRAME_EMBEDDING_ALLOW" default:"SAMEORIGIN"`HideLocalLogin bool `envconfig:"PULSE_AUTH_HIDE_LOCAL_LOGIN" default:"false"`DisableDockerUpdateActions bool `envconfig:"PULSE_DISABLE_DOCKER_UPDATE_ACTIONS" default:"false"` // Hide Docker update buttons (read-only mode for containers)@@ -166,20 +161,16 @@ type Config struct {TLSKeyFile string `envconfig:"TLS_KEY_FILE" default:""`// Update settings- UpdateChannel string `envconfig:"UPDATE_CHANNEL" default:"stable"`- AutoUpdateEnabled bool `envconfig:"AUTO_UPDATE_ENABLED" default:"false"`- AutoUpdateCheckInterval time.Duration `envconfig:"AUTO_UPDATE_CHECK_INTERVAL" default:"24h"`- AutoUpdateTime string `envconfig:"AUTO_UPDATE_TIME" default:"03:00"`+ UpdateChannel string+ AutoUpdateEnabled bool+ AutoUpdateCheckInterval time.Duration+ AutoUpdateTime string// Discovery settingsDiscoveryEnabled bool `envconfig:"DISCOVERY_ENABLED" default:"false"`DiscoverySubnet string `envconfig:"DISCOVERY_SUBNET" default:"auto"`Discovery DiscoveryConfig `json:"discoveryConfig"`- // Deprecated - for backward compatibility- Port int `envconfig:"PORT"` // Maps to BackendPort- Debug bool `envconfig:"DEBUG" default:"false"`-// Track which settings are overridden by environment variablesEnvOverrides map[string]bool `json:"-"`}@@ -460,7 +451,6 @@ type ClusterEndpoint struct {PulseReachable *bool // Pulse's view: can Pulse reach this endpoint? nil = not yet checkedLastPulseCheck *time.Time // Last time Pulse checked connectivityPulseError string // Last error Pulse encountered connecting to this endpoint-}// EffectiveIP returns the IP to use for this endpoint, preferring IPOverride if set@@ -565,20 +555,16 @@ func Load() (*Config, error) {// Initialize config with defaultscfg := &Config{- BackendHost: "",BackendPort: 3000,- FrontendHost: "",FrontendPort: 7655,ConfigPath: dataDir,DataPath: dataDir,AppRoot: detectAppRoot(),- ConcurrentPolling: true,ConnectionTimeout: 60 * time.Second,BackupPollingCycles: 10,BackupPollingInterval: 0,EnableBackupPolling: true,PVEPollingInterval: 10 * time.Second,- WebhookBatchDelay: 10 * time.Second,AdaptivePollingEnabled: false,AdaptivePollingBaseInterval: 10 * time.Second,AdaptivePollingMinInterval: 5 * time.Second,@@ -593,8 +579,7 @@ func Load() (*Config, error) {LogMaxSize: 100,LogMaxAge: 30,LogCompress: true,- AllowedOrigins: "", // Empty means no CORS headers (same-origin only)- IframeEmbeddingAllow: "SAMEORIGIN",+ AllowedOrigins: "", // Empty means no CORS headers (same-origin only)PBSPollingInterval: 60 * time.Second, // Default PBS polling (slower)PMGPollingInterval: 60 * time.Second, // Default PMG polling (aggregated stats)DiscoveryEnabled: false,@@ -1129,15 +1114,6 @@ func Load() (*Config, error) {}}- // Check if API token is enabled- if apiTokenEnabled := os.Getenv("API_TOKEN_ENABLED"); apiTokenEnabled != "" {- cfg.APITokenEnabled = apiTokenEnabled == "true" || apiTokenEnabled == "1"- log.Debug().Bool("enabled", cfg.APITokenEnabled).Msg("API token enabled status from env var")- } else if cfg.HasAPITokens() {- cfg.APITokenEnabled = true- log.Debug().Msg("API tokens exist without explicit enabled flag, assuming enabled for backwards compatibility")- }-// Legacy migration: if a single token is present without metadata, wrap it.if !cfg.HasAPITokens() && cfg.APIToken != "" {if record, err := NewHashedAPITokenRecord(cfg.APIToken, "Legacy token", time.Now().UTC(), nil); err == nil {diff --git a/internal/config/config_load_test.go b/internal/config/config_load_test.goindex 9c14c57dd1..76062cfbfb 100644--- a/internal/config/config_load_test.go+++ b/internal/config/config_load_test.go@@ -84,7 +84,7 @@ func TestLoad_APITokens_Migration(t *testing.T) {// But we only have token1, token2 in list.// If getting 3, something is weird. We assert >= 2.assert.GreaterOrEqual(t, len(cfg.APITokens), 2)- assert.True(t, cfg.APITokenEnabled)+ assert.True(t, cfg.HasAPITokens())// Verify hashedassert.NotEqual(t, "token1", cfg.APITokens[0].Hash)diff --git a/internal/config/persistence.go b/internal/config/persistence.goindex 3e3d6dcfb9..c338678607 100644--- a/internal/config/persistence.go+++ b/internal/config/persistence.go@@ -2080,9 +2080,16 @@ func (c *ConfigPersistence) updateEnvFile(envFile string, settings SystemSettingreturn nil}- // Write to temp file first+ // Write to temp file first using owner-only permissions.tempFile := envFile + ".tmp"- if err := c.fs.WriteFile(tempFile, []byte(content), 0644); err != nil {+ perm := os.FileMode(0600)+ if info, err := c.fs.Stat(envFile); err == nil {+ perm = info.Mode().Perm() & 0700+ if perm == 0 {+ perm = 0600+ }+ }+ if err := c.fs.WriteFile(tempFile, []byte(content), perm); err != nil {return err}diff --git a/internal/config/watcher.go b/internal/config/watcher.goindex 2d72fbc3a6..6ef88d9c48 100644--- a/internal/config/watcher.go+++ b/internal/config/watcher.go@@ -456,7 +456,6 @@ func (cw *ConfigWatcher) reloadConfig() {cw.config.APITokens = newRecordscw.config.SortAPITokens()- cw.config.APITokenEnabled = len(newRecords) > 0newHashes := cw.config.ActiveAPITokenHashes()if !reflect.DeepEqual(oldTokenHashes, newHashes) {@@ -541,7 +540,6 @@ func (cw *ConfigWatcher) reloadAPITokens() {Mu.Lock()cw.config.APITokens = tokenscw.config.SortAPITokens()- cw.config.APITokenEnabled = len(tokens) > 0Mu.Unlock()if cw.apiTokensPath != "" {diff --git a/internal/config/watcher_test.go b/internal/config/watcher_test.goindex df0a994eb0..94b2c46b97 100644--- a/internal/config/watcher_test.go+++ b/internal/config/watcher_test.go@@ -354,7 +354,7 @@ API_TOKENS="token2,token3"`cw.reloadConfig()assert.Len(t, cfg.APITokens, 3)- assert.True(t, cfg.APITokenEnabled)+ assert.True(t, cfg.HasAPITokens())// Scenario 2: Legacy tokens ignored if APITokens not empty (manually added via UI/Persistence)// Let's simulate that by adding a token directly to config