diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2022-06-06 16:46:10 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2022-06-06 16:46:10 -0700 |
| commit | f4a69647659df356f7f1d1ab1d8b4eedcc34dfba (patch) | |
| tree | f3e8f2cd4590db0a10d7d2f8ed2bcb0228046928 /cmd | |
| parent | 5350396308932e1dabdc10c7b342b528d2f60a15 (diff) | |
Improve handling of client config default path
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/mobius-hotline-client/main.go | 9 |
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: |