mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-22 11:13:26 +00:00
fix: use correct data path for guest metadata export/import
- Export/import now uses PULSE_DATA_DIR env var (defaults to /etc/pulse) - Guest console URLs and metadata are now properly included in backups - Fixed path mismatch between runtime (/etc/pulse) and export (/var/lib/pulse)
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/rcourtman/pulse-go-rewrite/internal/alerts"
|
||||
@@ -63,9 +64,12 @@ func (c *ConfigPersistence) ExportConfig(passphrase string) (string, error) {
|
||||
return "", fmt.Errorf("failed to load system settings: %w", err)
|
||||
}
|
||||
|
||||
// Load guest metadata (stored in data directory, not config directory)
|
||||
// Default to /var/lib/pulse if not specified
|
||||
dataPath := "/var/lib/pulse"
|
||||
// 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")
|
||||
if dataPath == "" {
|
||||
dataPath = "/etc/pulse"
|
||||
}
|
||||
guestMetadataStore := NewGuestMetadataStore(dataPath)
|
||||
guestMetadata := guestMetadataStore.GetAll()
|
||||
|
||||
@@ -149,7 +153,11 @@ func (c *ConfigPersistence) ImportConfig(encryptedData string, passphrase string
|
||||
|
||||
// Import guest metadata if present
|
||||
if exportData.GuestMetadata != nil && len(exportData.GuestMetadata) > 0 {
|
||||
dataPath := "/var/lib/pulse"
|
||||
// Use PULSE_DATA_DIR if set, otherwise use /etc/pulse for backwards compatibility
|
||||
dataPath := os.Getenv("PULSE_DATA_DIR")
|
||||
if dataPath == "" {
|
||||
dataPath = "/etc/pulse"
|
||||
}
|
||||
guestMetadataStore := NewGuestMetadataStore(dataPath)
|
||||
|
||||
// Import each guest metadata entry
|
||||
|
||||
Executable
BIN
Binary file not shown.
Reference in New Issue
Block a user