Skip to content

Commit efc3ce2

Browse files
authored
Update the token URL to point to the API settings page (#1215)
1 parent c1fb103 commit efc3ce2

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

cmd/cmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func validateUserConfig(cfg *viper.Viper) error {
6969
if cfg.GetString("token") == "" {
7070
return fmt.Errorf(
7171
msgWelcomePleaseConfigure,
72-
config.SettingsURL(cfg.GetString("apibaseurl")),
72+
config.TokenURL(cfg.GetString("apibaseurl")),
7373
BinaryName,
7474
)
7575
}

cmd/configure.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func runConfigure(configuration config.Config, flags *pflag.FlagSet) error {
6060
// If the command is run 'bare' and we have no token,
6161
// explain how to set the token.
6262
if flags.NFlag() == 0 && cfg.GetString("token") == "" {
63-
tokenURL := config.SettingsURL(cfg.GetString("apibaseurl"))
63+
tokenURL := config.TokenURL(cfg.GetString("apibaseurl"))
6464
return fmt.Errorf("There is no token configured. Find your token on %s, and call this command again with --token=<your-token>.", tokenURL)
6565
}
6666

@@ -107,7 +107,7 @@ func runConfigure(configuration config.Config, flags *pflag.FlagSet) error {
107107
token = cfg.GetString("token")
108108
}
109109

110-
tokenURL := config.SettingsURL(cfg.GetString("apibaseurl"))
110+
tokenURL := config.TokenURL(cfg.GetString("apibaseurl"))
111111

112112
// If we don't have a token then explain how to set it and bail.
113113
if token == "" {

cmd/troubleshoot.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ func newConfigurationStatus(status *Status) configurationStatus {
191191
Workspace: workspace,
192192
Dir: status.cfg.Dir,
193193
Token: v.GetString("token"),
194-
TokenURL: config.SettingsURL(v.GetString("apibaseurl")),
194+
TokenURL: config.TokenURL(v.GetString("apibaseurl")),
195195
}
196196
if status.Censor && cs.Token != "" {
197197
cs.Token = debug.Redact(cs.Token)

config/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func InferSiteURL(apiURL string) string {
128128
return re.ReplaceAllString(apiURL, "$1")
129129
}
130130

131-
// SettingsURL provides a link to where the user can find their API token.
132-
func SettingsURL(apiURL string) string {
133-
return fmt.Sprintf("%s%s", InferSiteURL(apiURL), "/my/settings")
131+
// TokenURL provides a link to where the user can find their API token.
132+
func TokenURL(apiURL string) string {
133+
return fmt.Sprintf("%s%s", InferSiteURL(apiURL), "/my/settings/api_cli")
134134
}

0 commit comments

Comments
 (0)