2024-10-24 10:53:46 +02:00
|
|
|
package statemanager
|
|
|
|
|
|
|
|
import (
|
2025-01-13 10:15:01 +01:00
|
|
|
"github.com/netbirdio/netbird/client/configs"
|
2024-10-24 10:53:46 +02:00
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
)
|
|
|
|
|
|
|
|
// GetDefaultStatePath returns the path to the state file based on the operating system
|
2024-11-13 13:46:00 +01:00
|
|
|
// It returns an empty string if the path cannot be determined.
|
2024-10-24 10:53:46 +02:00
|
|
|
func GetDefaultStatePath() string {
|
2025-01-13 10:15:01 +01:00
|
|
|
if path := os.Getenv("NB_DNS_STATE_FILE"); path != "" {
|
|
|
|
return path
|
2024-10-24 10:53:46 +02:00
|
|
|
}
|
2025-01-13 10:15:01 +01:00
|
|
|
return filepath.Join(configs.StateDir, "state.json")
|
2024-10-24 10:53:46 +02:00
|
|
|
}
|