(now time.Time)
| 166 | } |
| 167 | |
| 168 | func (c *storedCredential) shouldRefresh(now time.Time) bool { |
| 169 | if c.RefreshToken == "" { |
| 170 | return false |
| 171 | } |
| 172 | if c.AccessToken == "" { |
| 173 | return true |
| 174 | } |
| 175 | if c.Expiry == nil { |
| 176 | return false |
| 177 | } |
| 178 | return !c.Expiry.After(now.Add(tokenRefreshWindow)) |
| 179 | } |
| 180 | |
| 181 | func authFilePath() (string, error) { |
| 182 | if filePath := os.Getenv(envAuthFile); filePath != "" { |
no outgoing calls
no test coverage detected