diff --git a/cmd/common.go b/cmd/common.go index 0f9753881..f7b4a71ff 100644 --- a/cmd/common.go +++ b/cmd/common.go @@ -373,8 +373,11 @@ func sendAnalytics(cmd, kongVersion string, mode mode) error { } func inKonnectMode(targetContent *file.Content) bool { - if (targetContent != nil && targetContent.Konnect != nil) || - konnectConfig.Email != "" || + if targetContent != nil && targetContent.Konnect != nil { + return true + } else if rootConfig.Address != defaultKongURL { + return false + } else if konnectConfig.Email != "" || konnectConfig.Password != "" || konnectConfig.Token != "" { return true diff --git a/cmd/root.go b/cmd/root.go index b344734ab..72d0ad2b4 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -15,7 +15,10 @@ import ( "github.com/spf13/viper" ) -const defaultKonnectURL = "https://us.api.konghq.com" +const ( + defaultKongURL = "http://localhost:8001" + defaultKonnectURL = "https://us.api.konghq.com" +) var ( cfgFile string @@ -27,8 +30,9 @@ var ( konnectRuntimeGroup string ) -//nolint:errcheck // NewRootCmd represents the base command when called without any subcommands +// +//nolint:errcheck func NewRootCmd() *cobra.Command { rootCmd := &cobra.Command{ Use: "deck", @@ -50,7 +54,7 @@ It can be used to export, import, or sync entities to Kong.`, rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "Config file (default is $HOME/.deck.yaml).") - rootCmd.PersistentFlags().String("kong-addr", "http://localhost:8001", + rootCmd.PersistentFlags().String("kong-addr", defaultKongURL, "HTTP address of Kong's Admin API.\n"+ "This value can also be set using the environment variable DECK_KONG_ADDR\n"+ " environment variable.")