aboutsummaryrefslogtreecommitdiff
path: root/cmd/mobius-hotline-client/main.go
diff options
context:
space:
mode:
authorJeff Halter <868228+jhalter@users.noreply.github.com>2022-06-06 16:46:10 -0700
committerJeff Halter <868228+jhalter@users.noreply.github.com>2022-06-06 16:46:10 -0700
commitf4a69647659df356f7f1d1ab1d8b4eedcc34dfba (patch)
treef3e8f2cd4590db0a10d7d2f8ed2bcb0228046928 /cmd/mobius-hotline-client/main.go
parent5350396308932e1dabdc10c7b342b528d2f60a15 (diff)
Improve handling of client config default path
Diffstat (limited to 'cmd/mobius-hotline-client/main.go')
-rw-r--r--cmd/mobius-hotline-client/main.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/cmd/mobius-hotline-client/main.go b/cmd/mobius-hotline-client/main.go
index 6bc2d58..4bd40c9 100644
--- a/cmd/mobius-hotline-client/main.go
+++ b/cmd/mobius-hotline-client/main.go
@@ -97,12 +97,15 @@ var zapLogLevel = map[string]zapcore.Level{
}
func defaultConfigPath() (cfgPath string) {
- os := runtime.GOOS
- switch os {
+ switch runtime.GOOS {
case "windows":
cfgPath = "mobius-client-config.yaml"
case "darwin":
- cfgPath = "/usr/local/etc/mobius-client-config.yaml"
+ if _, err := os.Stat("/usr/local/etc/mobius-client-config.yaml"); err == nil {
+ cfgPath = "/usr/local/etc/mobius-client-config.yaml"
+ } else if _, err := os.Stat("/opt/homebrew/etc/mobius-client-config.yaml"); err == nil {
+ cfgPath = "/opt/homebrew/etc/mobius-client-config.yaml"
+ }
case "linux":
cfgPath = "/usr/local/etc/mobius-client-config.yaml"
default: