From 8ca5da1434c7ad1cc2e23e9d8a08d15b14382ebc Mon Sep 17 00:00:00 2001 From: Slack Coder Date: Thu, 3 Oct 2024 06:18:55 -0500 Subject: mod: Remove mergo dependency The small amount of configuration fields does not justify its inclusion. --- internal/service/config.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'internal/service') diff --git a/internal/service/config.go b/internal/service/config.go index 8105cd5..718be14 100644 --- a/internal/service/config.go +++ b/internal/service/config.go @@ -5,7 +5,6 @@ import ( "os" "time" - "dario.cat/mergo" "git.server.ky/slackcoder/mirror/internal" "github.com/BurntSushi/toml" ) @@ -50,10 +49,15 @@ var DefaultConfig = Config{ }, } -func (c *Config) Apply(arg Config) { - err := mergo.Merge(c, &arg) - if err != nil { - panic(err) +func (c *Config) Apply(src Config) { + if c.MaxInterval.Duration == 0 && src.MaxInterval.Duration != 0 { + c.MaxInterval = src.MaxInterval + } + if c.MinInterval.Duration == 0 && src.MinInterval.Duration != 0 { + c.MinInterval = src.MinInterval + } + if len(c.Mirrors) == 0 { + c.Mirrors = src.Mirrors } } -- cgit v1.2.3