From 0de9c72b3e39456c86962bc7366f4bcc7bbeb565 Mon Sep 17 00:00:00 2001 From: Michael Banck Date: Mon, 18 Nov 2024 11:35:40 +0100 Subject: [PATCH] Fix retry-num parameter handling. This introduces --retry-num and --retry-after command-line parameters and makes sure the value for `retry-num' is more than zero as otherwise the ARP client is not being launched. Fixes: #272 --- vipconfig/config.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vipconfig/config.go b/vipconfig/config.go index 6c1c93e..becd3cd 100644 --- a/vipconfig/config.go +++ b/vipconfig/config.go @@ -72,6 +72,9 @@ func defineFlags() { pflag.String("interval", "1000", "DCS scan interval in milliseconds.") pflag.String("manager-type", "basic", "Type of VIP-management to be used. Supported values: basic, hetzner.") + pflag.String("retry-after", "250", "Time to wait before retrying interactions with outside components in milliseconds.") + pflag.String("retry-num", "3", "Number of times interactions with outside components are retried.") + pflag.Bool("verbose", false, "Be verbose. Currently only implemented for manager-type=hetzner .") pflag.CommandLine.SortFlags = false @@ -200,6 +203,11 @@ func setDefaults() { viper.Set("trigger-value", triggerValue) } } + + // set retry-num to default if not set or set to zero + if retryNum := viper.GetString("retry-num"); retryNum == "" || retryNum == "0" { + viper.Set("retry-num", 3) + } } func checkSetting(name string) bool {