mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-11 14:00:29 +00:00
a4d37447a0
Discovering Docker inside Proxmox LXC guests previously required an undocumented environment variable plus a hand-edited systemd unit, which is how the surface kept shipping invisible. The opt-in is now a persisted system setting with an admin-only toggle in Settings → System → General, presented as its own "Docker in Proxmox LXCs" card under the existing Docker/Podman updates card, with the requirements (node agent with command execution) and data-collection bounds stated inline. The setting rides the admin-gated system settings endpoint (RequireAdmin + settings:write, matching every other server-wide toggle). Flipping it persists first, then applies to the runtime config and fires a reconfigure hook so the router rebuilds the monitor's Docker checker and inventory collector immediately — no restart. PULSE_ENABLE_PROXMOX_GUEST_DOCKER_INVENTORY remains authoritative: when set it locks the toggle (EnvironmentLockBadge in the UI, HTTP 400 from the API), and an unrelated settings save can never clobber the runtime value. The opt-in guardrail test now pins the settings path, the env lock, and the persisted field. Installer and node setup-guide callouts now point at the toggle first with the environment variable as the locking override, and the docs, their public mirrors, and the agent-lifecycle subsystem contract say the same. New i18n strings shipped for en/de/es. Verified live in mock mode: toggle off/on from the UI drives the collector teardown/setup log lines, the value survives a server restart, and all three touched surfaces render at desktop and mobile widths (receipt in frontend-modern/browser-verification.json).
30 lines
645 B
Go
30 lines
645 B
Go
package config
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func TestLoadAppliesPersistedGuestDockerInventoryOptIn(t *testing.T) {
|
|
dir := t.TempDir()
|
|
settings := map[string]interface{}{
|
|
"enableProxmoxGuestDockerInventory": true,
|
|
}
|
|
raw, _ := json.Marshal(settings)
|
|
if err := os.WriteFile(filepath.Join(dir, "system.json"), raw, 0o600); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Setenv("PULSE_DATA_DIR", dir)
|
|
t.Setenv("PULSE_MOCK_MODE", "true")
|
|
|
|
cfg, err := Load()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !cfg.EnableProxmoxGuestDockerInventory {
|
|
t.Fatal("persisted guest Docker inventory opt-in was not applied at load")
|
|
}
|
|
}
|