chore(deps): update module github.com/caarlos0/env/v11 to v11.2.2 (#380)

* chore(deps): update module github.com/caarlos0/env/v11 to v11.2.2

* fix replica handling

---------

Co-authored-by: Renovate Bot <renovate@whitesourcesoftware.com>
This commit is contained in:
Marc Brugger 2024-08-09 10:10:32 +02:00 committed by GitHub
parent 665b27cfbe
commit ad52f32a3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 3 deletions

2
go.mod
View file

@ -3,7 +3,7 @@ module github.com/bakito/adguardhome-sync
go 1.22.4 go 1.22.4
require ( require (
github.com/caarlos0/env/v11 v11.1.0 github.com/caarlos0/env/v11 v11.2.2
github.com/gin-gonic/gin v1.10.0 github.com/gin-gonic/gin v1.10.0
github.com/go-resty/resty/v2 v2.14.0 github.com/go-resty/resty/v2 v2.14.0
github.com/google/uuid v1.6.0 github.com/google/uuid v1.6.0

4
go.sum
View file

@ -8,8 +8,8 @@ github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM= github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
github.com/caarlos0/env/v11 v11.1.0 h1:a5qZqieE9ZfzdvbbdhTalRrHT5vu/4V1/ad1Ka6frhI= github.com/caarlos0/env/v11 v11.2.2 h1:95fApNrUyueipoZN/EhA8mMxiNxrBwDa+oAZrMWl3Kg=
github.com/caarlos0/env/v11 v11.1.0/go.mod h1:LwgkYk1kDvfGpHthrWWLof3Ny7PezzFwS4QrsJdHTMo= github.com/caarlos0/env/v11 v11.2.2/go.mod h1:JBfcdeQiBoI3Zh1QRAWfe+tpiNTmDtcCj/hHHHMx0vc=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=

View file

@ -39,6 +39,10 @@ func Get(configFile string, flags Flags) (*types.Config, error) {
replicaDhcpServer := cfg.Replica.DHCPServerEnabled replicaDhcpServer := cfg.Replica.DHCPServerEnabled
cfg.Replica.DHCPServerEnabled = nil cfg.Replica.DHCPServerEnabled = nil
// ignore replicas form env parsing as they are handled separately
replicas := cfg.Replicas
cfg.Replicas = nil
// overwrite from env vars // overwrite from env vars
if err = env.Parse(cfg); err != nil { if err = env.Parse(cfg); err != nil {
return nil, err return nil, err
@ -46,6 +50,9 @@ func Get(configFile string, flags Flags) (*types.Config, error) {
if err = env.ParseWithOptions(cfg.Replica, env.Options{Prefix: "REPLICA_"}); err != nil { if err = env.ParseWithOptions(cfg.Replica, env.Options{Prefix: "REPLICA_"}); err != nil {
return nil, err return nil, err
} }
// restore the replica
cfg.Replicas = replicas
// if not set from env, use previous value // if not set from env, use previous value
if cfg.Replica.DHCPServerEnabled == nil { if cfg.Replica.DHCPServerEnabled == nil {
cfg.Replica.DHCPServerEnabled = replicaDhcpServer cfg.Replica.DHCPServerEnabled = replicaDhcpServer