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.

feat: export API tokens in config export

rcourtmancdbc6057b0c1
diff --git a/internal/config/export.go b/internal/config/export.go
index 1aca2d07c5..e855195342 100644
--- a/internal/config/export.go
+++ b/internal/config/export.go
@@ -29,6 +29,7 @@ type ExportData struct {
System SystemSettings `json:"system"`
GuestMetadata map[string]*GuestMetadata `json:"guestMetadata,omitempty"`
OIDC *OIDCConfig `json:"oidc,omitempty"`
+ APITokens []APITokenRecord `json:"apiTokens,omitempty"`
}
// ExportConfig exports all configuration with passphrase-based encryption
@@ -79,6 +80,14 @@ func (c *ConfigPersistence) ExportConfig(passphrase string) (string, error) {
return "", fmt.Errorf("failed to load oidc configuration: %w", err)
}
+ apiTokens, err := c.LoadAPITokens()
+ if err != nil {
+ return "", fmt.Errorf("failed to load api tokens: %w", err)
+ }
+ if len(apiTokens) == 0 {
+ apiTokens = nil
+ }
+
// Load guest metadata (stored in data directory)
// Use PULSE_DATA_DIR if set, otherwise use /etc/pulse for backwards compatibility
dataPath := os.Getenv("PULSE_DATA_DIR")
@@ -100,6 +109,7 @@ func (c *ConfigPersistence) ExportConfig(passphrase string) (string, error) {
System: *systemSettings,
GuestMetadata: guestMetadata,
OIDC: oidcConfig,
+ APITokens: apiTokens,
}
// Marshal to JSON