Skip to content

Commit

Permalink
config: Provide better PAT information message
Browse files Browse the repository at this point in the history
When running 'lab' for the first time users see the message

Create a token here: profile/personal_access_tokens

This does not indicate the scope of the token and the URL is incorrect.

Fix the URL and output a better token creation message.

Signed-off-by: Prarit Bhargava <[email protected]>
Reported-by: David Arcari <[email protected]>
  • Loading branch information
prarit committed Oct 1, 2020
1 parent 6af6e84 commit 40cd2d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ func New(confpath string, r io.Reader) error {
var readPassword = func(reader bufio.Reader) (string, string, error) {
var loadToken string

tokenURL, err := url.Parse(viper.GetString("core.host"))
tokenURL, err := url.Parse(MainConfig.GetString("core.host"))
if err != nil {
return "", "", err
}
tokenURL.Path = "profile/personal_access_tokens"

fmt.Printf("Create a token here: %s\nEnter default GitLab token (scope: api), or leave blank to provide a command to load the token: ", tokenURL.String())
fmt.Printf("Create a token with scope 'api' here: %s\nEnter default GitLab token, or leave blank to provide a command to load the token: ", tokenURL.String())
byteToken, err := terminal.ReadPassword(int(syscall.Stdin))
if err != nil {
return "", "", err
Expand Down

0 comments on commit 40cd2d3

Please sign in to comment.