Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use /leader as default trigger key for Patroni DCS type #277

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions vipconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
}

// NewConfig returns a new Config instance
func NewConfig() (*Config, error) {

Check failure on line 249 in vipconfig/config.go

View workflow job for this annotation

GitHub Actions / Build & Test (ubuntu-latest)

cyclomatic complexity 18 of func `NewConfig` is high (> 16) (gocyclo)
var err error

defineFlags()
Expand Down Expand Up @@ -310,6 +310,14 @@
}
}

// 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" {
Expand Down
Loading