(hostname, user string)
| 513 | } |
| 514 | |
| 515 | func (c *AuthConfig) TokenForUser(hostname, user string) (string, string, error) { |
| 516 | if token, err := keyring.Get(keyringServiceName(hostname), user); err == nil { |
| 517 | return token, "keyring", nil |
| 518 | } |
| 519 | |
| 520 | if token, err := c.cfg.Get([]string{hostsKey, hostname, usersKey, user, oauthTokenKey}); err == nil { |
| 521 | return token, "oauth_token", nil |
| 522 | } |
| 523 | |
| 524 | return "", "default", fmt.Errorf("no token found for '%s'", user) |
| 525 | } |
| 526 | |
| 527 | func keyringServiceName(hostname string) string { |
| 528 | return "gh:" + hostname |
nothing calls this directly
no test coverage detected