Pull request 2287: 7315-fix-client-storage-panic
Closes #7315.
Squashed commit of the following:
commit 94c8473a14d98b45b5086de432bc68dd55eb654b
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Thu Oct 3 19:09:23 2024 +0300
all: upd chlog
commit 82b772b1dde19277832d44f9b22c47d22f90bf7e
Merge: e7f34cc43 4919630cc
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Thu Oct 3 19:00:53 2024 +0300
Merge branch 'master' into 7315-fix-client-storage-panic
commit e7f34cc435f53b80aca328a62e27c6aaa8fe6462
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Thu Oct 3 17:55:39 2024 +0300
home: fix client storage panic
This commit is contained in:
@@ -92,9 +92,9 @@ func (clients *clientsContainer) Init(
|
||||
// TODO(e.burkov): The option should probably be returned, since hosts file
|
||||
// currently used not only for clients' information enrichment, but also in
|
||||
// the filtering module and upstream addresses resolution.
|
||||
var hosts client.HostsContainer = etcHosts
|
||||
if !config.Clients.Sources.HostsFile {
|
||||
hosts = nil
|
||||
var hosts client.HostsContainer
|
||||
if config.Clients.Sources.HostsFile && etcHosts != nil {
|
||||
hosts = etcHosts
|
||||
}
|
||||
|
||||
clients.storage, err = client.NewStorage(&client.StorageConfig{
|
||||
|
||||
@@ -148,6 +148,14 @@ func setupContext(opts options) (err error) {
|
||||
Context.tlsRoots = aghtls.SystemRootCAs()
|
||||
Context.mux = http.NewServeMux()
|
||||
|
||||
if !opts.noEtcHosts {
|
||||
err = setupHostsContainer()
|
||||
if err != nil {
|
||||
// Don't wrap the error, because it's informative enough as is.
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if Context.firstRun {
|
||||
log.Info("This is the first time AdGuard Home is launched")
|
||||
checkPermissions()
|
||||
@@ -168,14 +176,6 @@ func setupContext(opts options) (err error) {
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
if !opts.noEtcHosts {
|
||||
err = setupHostsContainer()
|
||||
if err != nil {
|
||||
// Don't wrap the error, because it's informative enough as is.
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user