Files
pekoe/internal/config/configpath_linux.go
2026-04-03 00:09:40 +03:00

30 lines
572 B
Go

//go:build linux
// @tag config
// @tag platform:linux
package config
import (
"os"
"path/filepath"
)
// DefaultConfigPaths returns the config file search paths for Linux.
// Root user: only /etc/pekoe/config.json
// Regular user: ~/.pekoe.json, then /etc/pekoe/config.json
func DefaultConfigPaths() []string {
if os.Getuid() == 0 {
return []string{"/etc/pekoe/config.json"}
}
home, err := os.UserHomeDir()
if err != nil {
return []string{"/etc/pekoe/config.json"}
}
return []string{
filepath.Join(home, ".pekoe.json"),
"/etc/pekoe/config.json",
}
}