mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-18 16:26:38 +00:00
[client] Fix profile directory path handling based on NB_STATE_DIR (#4229)
[client] Fix profile directory path handling based on NB_STATE_DIR (#4229)
This commit is contained in:
@@ -34,14 +34,18 @@ func init() {
|
|||||||
DefaultConfigPathDir = "/var/lib/netbird/"
|
DefaultConfigPathDir = "/var/lib/netbird/"
|
||||||
oldDefaultConfigPathDir = "/etc/netbird/"
|
oldDefaultConfigPathDir = "/etc/netbird/"
|
||||||
|
|
||||||
switch runtime.GOOS {
|
if stateDir := os.Getenv("NB_STATE_DIR"); stateDir != "" {
|
||||||
case "windows":
|
DefaultConfigPathDir = stateDir
|
||||||
oldDefaultConfigPathDir = filepath.Join(os.Getenv("PROGRAMDATA"), "Netbird")
|
} else {
|
||||||
DefaultConfigPathDir = oldDefaultConfigPathDir
|
switch runtime.GOOS {
|
||||||
|
case "windows":
|
||||||
|
oldDefaultConfigPathDir = filepath.Join(os.Getenv("PROGRAMDATA"), "Netbird")
|
||||||
|
DefaultConfigPathDir = oldDefaultConfigPathDir
|
||||||
|
|
||||||
case "freebsd":
|
case "freebsd":
|
||||||
oldDefaultConfigPathDir = "/var/db/netbird/"
|
oldDefaultConfigPathDir = "/var/db/netbird/"
|
||||||
DefaultConfigPathDir = oldDefaultConfigPathDir
|
DefaultConfigPathDir = oldDefaultConfigPathDir
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
oldDefaultConfigPath = filepath.Join(oldDefaultConfigPathDir, "config.json")
|
oldDefaultConfigPath = filepath.Join(oldDefaultConfigPathDir, "config.json")
|
||||||
|
|||||||
Reference in New Issue
Block a user