Skip to content

Commit

Permalink
fix: default konnect url with konnect addr flag not accounted for. (#…
Browse files Browse the repository at this point in the history
…1398)

Previously, if a deck command was issued with --konnect-addr flag
but with the default konnectUrl https://us.api.konghq.com, the
flag value was getting ignored as deck could not figure out
if it was passed by flag or not. This change ensures that if the
flag is set, deck commands are issued against Konnect.

Fixes: #1385
  • Loading branch information
Prashansa-K authored Sep 25, 2024
1 parent a50b695 commit fd1fec7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cmd/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,8 @@ func inKonnectMode(targetContent *file.Content) bool {
konnectConfig.Password != "" ||
konnectConfig.Token != "" {
return true
} else if konnectConnectionDesired {
return true
}
return false
}
7 changes: 6 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ var (
rootConfig utils.KongClientConfig
konnectConfig utils.KonnectConfig

disableAnalytics bool
disableAnalytics bool
konnectConnectionDesired bool

konnectRuntimeGroup string
konnectControlPlane string
Expand Down Expand Up @@ -378,6 +379,10 @@ func initConfig() {
color.NoColor = viper.GetBool("no-color")
}

if viper.IsSet("konnect-addr") {
konnectConnectionDesired = true
}

if err := initKonnectConfig(); err != nil {
fmt.Println(err)
os.Exit(1)
Expand Down

0 comments on commit fd1fec7

Please sign in to comment.