From 1634a0633094527fa0d8b3d19ccf4c0c50bdd8ad Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Fri, 9 Aug 2024 14:22:09 +0700 Subject: [PATCH] all: change refresh_time -> refetch_time The custom config is refetched from API, not refresh. --- cmd/cli/prog.go | 4 ++-- config.go | 2 +- docs/config.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/cli/prog.go b/cmd/cli/prog.go index 8ee0df1..d2b9ed3 100644 --- a/cmd/cli/prog.go +++ b/cmd/cli/prog.go @@ -247,8 +247,8 @@ func (p *prog) apiConfigReload() { } secs := 3600 - if p.cfg.Service.RefreshTime != nil && *p.cfg.Service.RefreshTime > 0 { - secs = *p.cfg.Service.RefreshTime + if p.cfg.Service.RefetchTime != nil && *p.cfg.Service.RefetchTime > 0 { + secs = *p.cfg.Service.RefetchTime } ticker := time.NewTicker(time.Duration(secs) * time.Second) diff --git a/config.go b/config.go index 67420e5..e61f869 100644 --- a/config.go +++ b/config.go @@ -209,7 +209,7 @@ type ServiceConfig struct { MetricsListener string `mapstructure:"metrics_listener" toml:"metrics_listener,omitempty"` DnsWatchdogEnabled *bool `mapstructure:"dns_watchdog_enabled" toml:"dns_watchdog_enabled,omitempty"` DnsWatchdogInvterval *time.Duration `mapstructure:"dns_watchdog_interval" toml:"dns_watchdog_interval,omitempty"` - RefreshTime *int `mapstructure:"refresh_time" toml:"refresh_time,omitempty"` + RefetchTime *int `mapstructure:"refetch_time" toml:"refetch_time,omitempty"` Daemon bool `mapstructure:"-" toml:"-"` AllocateIP bool `mapstructure:"-" toml:"-"` } diff --git a/docs/config.md b/docs/config.md index ab5cf73..8c216ec 100644 --- a/docs/config.md +++ b/docs/config.md @@ -273,7 +273,7 @@ If the time duration is non-positive, default value will be used. - Required: no - Default: 20s -### refresh_time +### refetch_time Time in seconds between each iteration that reloads custom config if changed. The value must be a positive number, any invalid value will be ignored and default value will be used.