diff --git a/internal/home/home.go b/internal/home/home.go index 3f80cb07..aab8eadb 100644 --- a/internal/home/home.go +++ b/internal/home/home.go @@ -539,13 +539,13 @@ func fatalOnError(err error) { // run configures and starts AdGuard Home. func run(opts options, clientBuildFS fs.FS, done chan struct{}) { - // Configure config filename. - initConfigFilename(opts) - - // Configure working dir and config path. + // Configure working dir. err := initWorkingDir(opts) fatalOnError(err) + // Configure config filename. + initConfigFilename(opts) + // Configure log level and output. err = configureLogger(opts) fatalOnError(err) @@ -764,7 +764,7 @@ func writePIDFile(fn string) bool { func initConfigFilename(opts options) { confPath := opts.confFilename if confPath == "" { - Context.confFilePath = "AdGuardHome.yaml" + Context.confFilePath = filepath.Join(Context.workDir, "AdGuardHome.yaml") return } diff --git a/internal/home/service.go b/internal/home/service.go index 727b8732..3e153f53 100644 --- a/internal/home/service.go +++ b/internal/home/service.go @@ -271,10 +271,10 @@ func handleServiceCommand(s service.Service, action string, opts options) (err e return fmt.Errorf("failed to run service: %w", err) } case "install": - initConfigFilename(opts) if err = initWorkingDir(opts); err != nil { return fmt.Errorf("failed to init working dir: %w", err) } + initConfigFilename(opts) handleServiceInstallCommand(s) case "uninstall":