From 4e4293a3cbcad131bbbb7a1cc718810e8b7d69a0 Mon Sep 17 00:00:00 2001 From: Michael Banck Date: Fri, 15 Nov 2024 10:55:34 +0100 Subject: [PATCH] Use /leader as default trigger key for Patroni DCS type --- vipconfig/config.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vipconfig/config.go b/vipconfig/config.go index 6d2aeb0..711d6f3 100644 --- a/vipconfig/config.go +++ b/vipconfig/config.go @@ -310,6 +310,14 @@ func NewConfig() (*Config, error) { } } + // set trigger-key to '/leader' if DCS type is patroni and nothing is specified + if triggerKey := viper.GetString("trigger-key"); len(triggerKey) == 0 { + if viper.GetString("dcs-type") == "patroni" { + triggerKey = "/leader" + viper.Set("trigger-key", triggerKey) + } + } + // set trigger-value to default value if nothing is specified if triggerValue := viper.GetString("trigger-value"); len(triggerValue) == 0 { if viper.GetString("dcs-type") == "patroni" {