(hostname, user string)
| 500 | } |
| 501 | |
| 502 | func (c *AuthConfig) TokenForUser(hostname, user string) (string, string, error) { |
| 503 | if token, err := keyring.Get(keyringServiceName(hostname), user); err == nil { |
| 504 | return token, "keyring", nil |
| 505 | } |
| 506 | |
| 507 | if token, err := c.cfg.Get([]string{hostsKey, hostname, usersKey, user, oauthTokenKey}); err == nil { |
| 508 | return token, "oauth_token", nil |
| 509 | } |
| 510 | |
| 511 | return "", "default", fmt.Errorf("no token found for '%s'", user) |
| 512 | } |
| 513 | |
| 514 | func keyringServiceName(hostname string) string { |
| 515 | return "gh:" + hostname |
nothing calls this directly
no test coverage detected