Skip to content

Commit 40b40a1

Browse files
committed
use pflag.Int() for integer parameters
1 parent 0de9c72 commit 40b40a1

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

vipconfig/config.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ func defineFlags() {
6969

7070
pflag.String("consul-token", "", "Token for consul DCS endpoints.")
7171

72-
pflag.String("interval", "1000", "DCS scan interval in milliseconds.")
72+
pflag.Int("interval", 1000, "DCS scan interval in milliseconds.")
7373
pflag.String("manager-type", "basic", "Type of VIP-management to be used. Supported values: basic, hetzner.")
7474

75-
pflag.String("retry-after", "250", "Time to wait before retrying interactions with outside components in milliseconds.")
76-
pflag.String("retry-num", "3", "Number of times interactions with outside components are retried.")
75+
pflag.Int("retry-after", 250, "Time to wait before retrying interactions with outside components in milliseconds.")
76+
pflag.Int("retry-num", 3, "Number of times interactions with outside components are retried.")
7777

7878
pflag.Bool("verbose", false, "Be verbose. Currently only implemented for manager-type=hetzner .")
7979

@@ -156,12 +156,12 @@ func mapDeprecated() error {
156156
}
157157

158158
func setDefaults() {
159-
defaults := map[string]string{
160-
"dcs-type": "etcd",
161-
"interval": "1000",
159+
defaults := map[string]any{
162160
"hostingtype": "basic",
163-
"retry-num": "3",
164-
"retry-after": "250",
161+
"dcs-type": "etcd",
162+
"interval": 1000,
163+
"retry-after": 250,
164+
"retry-num": 3,
165165
}
166166

167167
for k, v := range defaults {
@@ -205,7 +205,7 @@ func setDefaults() {
205205
}
206206

207207
// set retry-num to default if not set or set to zero
208-
if retryNum := viper.GetString("retry-num"); retryNum == "" || retryNum == "0" {
208+
if retryNum := viper.GetInt("retry-num"); retryNum <= 0 {
209209
viper.Set("retry-num", 3)
210210
}
211211
}

0 commit comments

Comments
 (0)