home: fix conf symlink usage

This commit is contained in:
Dimitry Kolyshev 2024-03-27 13:43:17 +08:00
parent 2611534de0
commit 5476625eac
2 changed files with 6 additions and 6 deletions

View File

@ -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
}

View File

@ -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":