mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-30 11:31:29 +02:00
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
package configs
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"runtime"
|
|
)
|
|
|
|
// UILogFile is the file name the desktop UI writes its log to. It is defined
|
|
// here so the UI (writer), the daemon's RegisterUILog validation, and the debug
|
|
// bundle collector all share one definition.
|
|
const UILogFile = "gui-client.log"
|
|
|
|
var (
|
|
// StateDir holds persistent state (config, profiles, install metadata).
|
|
StateDir string
|
|
// RuntimeDir holds ephemeral artifacts that should not survive reboot,
|
|
// such as Unix sockets for daemon and per-session IPC. Empty on
|
|
// platforms without a conventional /var/run-style location.
|
|
RuntimeDir string
|
|
)
|
|
|
|
func init() {
|
|
switch runtime.GOOS {
|
|
case "windows":
|
|
StateDir = filepath.Join(os.Getenv("PROGRAMDATA"), "Netbird")
|
|
case "darwin", "linux":
|
|
StateDir = "/var/lib/netbird"
|
|
RuntimeDir = "/var/run/netbird"
|
|
case "freebsd", "openbsd", "netbsd", "dragonfly":
|
|
StateDir = "/var/db/netbird"
|
|
RuntimeDir = "/var/run/netbird"
|
|
}
|
|
if v := os.Getenv("NB_STATE_DIR"); v != "" {
|
|
StateDir = v
|
|
}
|
|
if v := os.Getenv("NB_RUNTIME_DIR"); v != "" {
|
|
RuntimeDir = v
|
|
}
|
|
}
|