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