(hostname, user string)
| 563 | } |
| 564 | |
| 565 | func (c *AuthConfig) TokenForUser(hostname, user string) (string, string, error) { |
| 566 | if token, err := keyring.Get(keyringServiceName(hostname), user); err == nil { |
| 567 | return token, "keyring", nil |
| 568 | } |
| 569 | |
| 570 | if token, err := c.cfg.Get([]string{hostsKey, hostname, usersKey, user, oauthTokenKey}); err == nil { |
| 571 | return token, "oauth_token", nil |
| 572 | } |
| 573 | |
| 574 | return "", "default", fmt.Errorf("no token found for '%s'", user) |
| 575 | } |
| 576 | |
| 577 | func keyringServiceName(hostname string) string { |
| 578 | return "gh:" + hostname |
nothing calls this directly
no test coverage detected