Pull request: 6717-fix-conf-symlink

Updates .

Squashed commit of the following:

commit d17a6de1485e68887a1732dfaa6844f433519b9f
Merge: 806ff9bad 9305c4581
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Mon Apr 1 09:22:33 2024 +0800

    Merge remote-tracking branch 'origin/master' into 6717-fix-conf-symlink

    # Conflicts:
    #	CHANGELOG.md

commit 806ff9bad09e8bf253a1bdc379fbed2b1a56c5a7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Thu Mar 28 09:00:00 2024 +0800

    home: imp code

commit 06dbcfead7c43fac146e92e4a83145dcd5c07b40
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Wed Mar 27 13:55:30 2024 +0800

    all: changelog

commit 5476625eacfda06efec768865e0885c502d37607
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Wed Mar 27 13:43:17 2024 +0800

    home: fix conf symlink usage
This commit is contained in:
Dimitry Kolyshev 2024-04-01 11:31:51 +03:00
parent 9305c45813
commit 7d9f33b2f0
3 changed files with 12 additions and 7 deletions
internal/home

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)
@ -760,11 +760,12 @@ 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 == "" {
Context.confFilePath = "AdGuardHome.yaml"
Context.confFilePath = filepath.Join(Context.workDir, "AdGuardHome.yaml")
return
}