Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

fix(config): restore legacy PORT fallback for FRONTEND_PORT with deprecation warning

rcourtman43bc15c12f91
diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md
index a5771e9ddd..720d1833f5 100644
--- a/docs/CONFIGURATION.md
+++ b/docs/CONFIGURATION.md
@@ -199,6 +199,7 @@ Environment variables take precedence over `system.json`.
| Variable | Description | Default |
| ---------- | ------------- | --------- |
| `FRONTEND_PORT` | Public listening port (web UI, API, and agent ingest) | `7655` |
+| `PORT` | **Deprecated** legacy alias for `FRONTEND_PORT`, honored only when `FRONTEND_PORT` is unset. Logs a deprecation warning at startup; switch to `FRONTEND_PORT`. | *(unset)* |
| `PULSE_AGENT_INGEST_PORT` | Optional dedicated port that serves **only** agent ingest (`/api/agents/*`), network-isolated from the web UI and the rest of the API. `0` = disabled (single port). See [Split-Port Agent Ingest](#split-port-agent-ingest-network-isolation). | `0` |
| `LOG_LEVEL` | Log verbosity (see below) | `info` |
| `LOG_FORMAT` | Log output format (`auto`, `json`, `console`) | `auto` |
diff --git a/docs/releases/V6_CHANGELOG.md b/docs/releases/V6_CHANGELOG.md
index 17240a3318..0b094b9ac7 100644
--- a/docs/releases/V6_CHANGELOG.md
+++ b/docs/releases/V6_CHANGELOG.md
@@ -122,6 +122,8 @@ the navigation shape you already know.
- **Bootstrap material is more controlled.** Setup-script flows now use explicit short-lived setup tokens and generated commands with governed privilege-escalation wrappers. Automation that assumed the older install-command shape may need changes.
+- **The legacy `PORT` variable is deprecated.** V6 still honors `PORT` as a fallback for `FRONTEND_PORT` so existing Docker and manual installs keep their configured port after upgrade, but it logs a deprecation warning at startup and `FRONTEND_PORT` wins when both are set. Move deployments to `FRONTEND_PORT`.
+
## Under the hood but important
- **V6 ships with a real v5 upgrade path.** The migration tests cover config
diff --git a/internal/config/config.go b/internal/config/config.go
index 2b5556466d..4d2af0cece 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -1313,6 +1313,16 @@ func load(initLogging bool) (*Config, error) {
} else {
log.Warn().Str("value", frontendPort).Msg("Ignoring invalid FRONTEND_PORT from environment")
}
+ } else if legacyPort := utils.GetenvTrim("PORT"); legacyPort != "" {
+ // v5 honored PORT as a documented alias for FRONTEND_PORT; keep it as a
+ // lowest-precedence fallback so upgraded installs stay reachable.
+ if p, err := parsePortOverride("PORT", legacyPort); err == nil {
+ cfg.FrontendPort = p
+ cfg.EnvOverrides["FRONTEND_PORT"] = true
+ log.Warn().Int("port", p).Msg("Overriding frontend port from legacy PORT env var. PORT is deprecated; set FRONTEND_PORT instead")
+ } else {
+ log.Warn().Str("value", legacyPort).Msg("Ignoring invalid legacy PORT from environment")
+ }
}
if agentIngestPort := utils.GetenvTrim("PULSE_AGENT_INGEST_PORT"); agentIngestPort != "" {
diff --git a/internal/config/config_env_overrides_test.go b/internal/config/config_env_overrides_test.go
index 99ee8a7f78..c19631711b 100644
--- a/internal/config/config_env_overrides_test.go
+++ b/internal/config/config_env_overrides_test.go
@@ -231,10 +231,30 @@ func TestLoad_EnvOverrides_InvalidFrontendPortIgnored(t *testing.T) {
assert.Equal(t, 7655, cfg.FrontendPort)
})
- t.Run("legacy PORT ignored", func(t *testing.T) {
+ t.Run("legacy PORT honored as fallback", func(t *testing.T) {
t.Setenv("PULSE_DATA_DIR", t.TempDir())
t.Setenv("PORT", "8080")
+ cfg, err := Load()
+ require.NoError(t, err)
+ assert.Equal(t, 8080, cfg.FrontendPort)
+ assert.True(t, cfg.EnvOverrides["FRONTEND_PORT"])
+ })
+
+ t.Run("FRONTEND_PORT wins over legacy PORT", func(t *testing.T) {
+ t.Setenv("PULSE_DATA_DIR", t.TempDir())
+ t.Setenv("FRONTEND_PORT", "9090")
+ t.Setenv("PORT", "8080")
+
+ cfg, err := Load()
+ require.NoError(t, err)
+ assert.Equal(t, 9090, cfg.FrontendPort)
+ })
+
+ t.Run("invalid legacy PORT ignored", func(t *testing.T) {
+ t.Setenv("PULSE_DATA_DIR", t.TempDir())
+ t.Setenv("PORT", "not-a-port")
+
cfg, err := Load()
require.NoError(t, err)
assert.Equal(t, 7655, cfg.FrontendPort)