Skip to content

Commit

Permalink
Merge branch 'master' into upd-golibs
Browse files Browse the repository at this point in the history
  • Loading branch information
ainar-g committed Apr 2, 2024
2 parents b6ca80a + d4fff41 commit 185ccdd
Show file tree
Hide file tree
Showing 7 changed files with 206 additions and 310 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ NOTE: Add new changes BELOW THIS COMMENT.

### Changed

- Time Zone Database is now embedded in the binary ([#6758]).
- Failed authentication attempts show the originating IP address in the logs, if
the request came from a trusted proxy ([#5829]).

Expand All @@ -35,7 +36,16 @@ NOTE: Add new changes BELOW THIS COMMENT.
will cause errors on startup in a future version.
- Node.JS 16. Future versions will require at least Node.JS 18 to build.

### Fixed

- Resetting DNS upstream mode when applying unrelated settings ([#6851]).
- Symbolic links to config YAML are replaced by a copy of the real file by AGH
after startup ([#6717]).

[#5829]: https://github.com/AdguardTeam/AdGuardHome/issues/5829
[#6717]: https://github.com/AdguardTeam/AdGuardHome/issues/6717
[#6758]: https://github.com/AdguardTeam/AdGuardHome/issues/6758
[#6851]: https://github.com/AdguardTeam/AdGuardHome/issues/6851

<!--
NOTE: Add new changes ABOVE THIS COMMENT.
Expand Down
480 changes: 179 additions & 301 deletions README.md

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions internal/dnsforward/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,6 @@ func (s *Server) setConfig(dc *jsonDNSConfig) (shouldRestart bool) {

if dc.UpstreamMode != nil {
s.conf.UpstreamMode = mustParseUpstreamMode(*dc.UpstreamMode)
} else {
s.conf.UpstreamMode = UpstreamModeLoadBalance
}

if dc.EDNSCSUseCustom != nil && *dc.EDNSCSUseCustom {
Expand Down
4 changes: 4 additions & 0 deletions internal/dnsforward/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ import (
"github.com/stretchr/testify/require"
)

// TODO(e.burkov): Use the better approach to testdata with a separate
// directory for each test, and a separate file for each subtest. See the
// [configmigrate] package.

// emptySysResolvers is an empty [SystemResolvers] implementation that always
// returns nil.
type emptySysResolvers struct{}
Expand Down
13 changes: 7 additions & 6 deletions internal/home/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
Expand Down
3 changes: 2 additions & 1 deletion internal/home/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,12 @@ 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":
handleServiceUninstallCommand(s)
Expand Down
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ package main

import (
"embed"
// Embed tzdata in binary.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/6758
_ "time/tzdata"

"github.com/AdguardTeam/AdGuardHome/internal/home"
)
Expand Down

0 comments on commit 185ccdd

Please sign in to comment.