Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func validateUserConfig(cfg *viper.Viper) error {
if cfg.GetString("token") == "" {
return fmt.Errorf(
msgWelcomePleaseConfigure,
config.SettingsURL(cfg.GetString("apibaseurl")),
config.TokenURL(cfg.GetString("apibaseurl")),
BinaryName,
)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func runConfigure(configuration config.Config, flags *pflag.FlagSet) error {
// If the command is run 'bare' and we have no token,
// explain how to set the token.
if flags.NFlag() == 0 && cfg.GetString("token") == "" {
tokenURL := config.SettingsURL(cfg.GetString("apibaseurl"))
tokenURL := config.TokenURL(cfg.GetString("apibaseurl"))
return fmt.Errorf("There is no token configured. Find your token on %s, and call this command again with --token=<your-token>.", tokenURL)
}

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

tokenURL := config.SettingsURL(cfg.GetString("apibaseurl"))
tokenURL := config.TokenURL(cfg.GetString("apibaseurl"))

// If we don't have a token then explain how to set it and bail.
if token == "" {
Expand Down
2 changes: 1 addition & 1 deletion cmd/troubleshoot.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func newConfigurationStatus(status *Status) configurationStatus {
Workspace: workspace,
Dir: status.cfg.Dir,
Token: v.GetString("token"),
TokenURL: config.SettingsURL(v.GetString("apibaseurl")),
TokenURL: config.TokenURL(v.GetString("apibaseurl")),
}
if status.Censor && cs.Token != "" {
cs.Token = debug.Redact(cs.Token)
Expand Down
6 changes: 3 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func InferSiteURL(apiURL string) string {
return re.ReplaceAllString(apiURL, "$1")
}

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