diff --git a/README.md b/README.md index b6b82d1..9cd48a4 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ urlMap: name: my-other-cm key: config.json namespace: foo + interval: 5m # how frequently to download, defaults to 60s "https://fs.example.com/secret": type: Secret name: my-other-secret diff --git a/go.mod b/go.mod index ffd8c15..bf837d8 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module github.com/luisdavim/configmapper -go 1.22.0 - -toolchain go1.23.2 +go 1.23 require ( github.com/fsnotify/fsnotify v1.8.0 diff --git a/pkg/downloader/downloader.go b/pkg/downloader/downloader.go index b647a72..a9b9121 100644 --- a/pkg/downloader/downloader.go +++ b/pkg/downloader/downloader.go @@ -19,7 +19,10 @@ import ( "github.com/luisdavim/configmapper/pkg/utils" ) -const DefaultKey = "config" +const ( + DefaultKey = "config" + DefaultInterval = time.Minute +) type Downloader struct { config config.URLMap @@ -67,6 +70,9 @@ func New(cfg config.URLMap) (*Downloader, error) { c.Key = DefaultKey } } + if c.Interval.Duration == 0 { + c.Interval.Duration = DefaultInterval + } } return d, nil