aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorSlack Coder <slackcoder@server.ky>2024-10-03 06:18:55 -0500
committerSlack Coder <slackcoder@server.ky>2024-10-03 06:18:49 -0500
commit8ca5da1434c7ad1cc2e23e9d8a08d15b14382ebc (patch)
tree94bba4dee27ff126977128b39cefbf90f97c5387 /internal
parent2e21de533046236bf71c3f178d1b3d5eb0f2311e (diff)
downloadmirror-8ca5da1434c7ad1cc2e23e9d8a08d15b14382ebc.tar.xz
mod: Remove mergo dependency
The small amount of configuration fields does not justify its inclusion.
Diffstat (limited to 'internal')
-rw-r--r--internal/service/config.go14
1 files changed, 9 insertions, 5 deletions
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
}
}