Renamed config param for node update check internal

This commit is contained in:
Juan Font Alonso 2022-07-12 12:52:03 +02:00
parent 8e0939f403
commit 5b5298b025
4 changed files with 14 additions and 14 deletions

View file

@ -26,7 +26,7 @@ type Config struct {
GRPCAddr string
GRPCAllowInsecure bool
EphemeralNodeInactivityTimeout time.Duration
ChangesCheckInterval time.Duration
NodeUpdateCheckInterval time.Duration
IPPrefixes []netaddr.IPPrefix
PrivateKeyPath string
BaseDomain string
@ -163,7 +163,7 @@ func LoadConfig(path string, isFile bool) error {
viper.SetDefault("ephemeral_node_inactivity_timeout", "120s")
viper.SetDefault("changes_check_interval", "10s")
viper.SetDefault("node_update_check_interval", "10s")
if err := viper.ReadInConfig(); err != nil {
log.Warn().Err(err).Msg("Failed to read configuration from disk")
@ -220,12 +220,12 @@ func LoadConfig(path string, isFile bool) error {
)
}
maxChangesCheckInterval, _ := time.ParseDuration("60s")
if viper.GetDuration("changes_check_interval") > maxChangesCheckInterval {
maxNodeUpdateCheckInterval, _ := time.ParseDuration("60s")
if viper.GetDuration("node_update_check_interval") > maxNodeUpdateCheckInterval {
errorText += fmt.Sprintf(
"Fatal config error: changes_check_interval (%s) is set too high, must be less than %s",
viper.GetString("changes_check_interval"),
maxChangesCheckInterval,
"Fatal config error: node_update_check_interval (%s) is set too high, must be less than %s",
viper.GetString("node_update_check_interval"),
maxNodeUpdateCheckInterval,
)
}
@ -490,8 +490,8 @@ func GetHeadscaleConfig() (*Config, error) {
"ephemeral_node_inactivity_timeout",
),
ChangesCheckInterval: viper.GetDuration(
"changes_check_interval",
NodeUpdateCheckInterval: viper.GetDuration(
"node_update_check_interval",
),
DBtype: viper.GetString("db_type"),