aboutsummaryrefslogtreecommitdiffsponsor
path: root/internal/service/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/service/config.go')
-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
}
}