diff --git a/internal/home/home.go b/internal/home/home.go index aab8eadb38f..8060467a0ac 100644 --- a/internal/home/home.go +++ b/internal/home/home.go @@ -760,7 +760,8 @@ func writePIDFile(fn string) bool { } // initConfigFilename sets up context config file path. This file path can be -// overridden by command-line arguments, or is set to default. +// overridden by command-line arguments, or is set to default. Must only be +// called after initializing the workDir with initWorkingDir. func initConfigFilename(opts options) { confPath := opts.confFilename if confPath == "" { diff --git a/internal/home/service.go b/internal/home/service.go index 3e153f53625..cb8f9b8bb1f 100644 --- a/internal/home/service.go +++ b/internal/home/service.go @@ -274,6 +274,7 @@ func handleServiceCommand(s service.Service, action string, opts options) (err e if err = initWorkingDir(opts); err != nil { return fmt.Errorf("failed to init working dir: %w", err) } + initConfigFilename(opts) handleServiceInstallCommand(s)