optionalSeconds reads a raw lifetime in seconds (an ExpiresIn field) from config, returning 0 when the key is absent so a credential without the value is still valid.
(path []string)
| 285 | // optionalSeconds reads a raw lifetime in seconds (an ExpiresIn field) from config, returning 0 when the key is absent |
| 286 | // so a credential without the value is still valid. |
| 287 | func (c *AuthConfig) optionalSeconds(path []string) (int, error) { |
| 288 | value, err := c.cfg.Get(path) |
| 289 | if isKeyNotFound(err) { |
| 290 | return 0, nil |
| 291 | } |
| 292 | if err != nil { |
| 293 | return 0, err |
| 294 | } |
| 295 | seconds, err := strconv.Atoi(value) |
| 296 | if err != nil { |
| 297 | return 0, errors.New("invalid refreshable credential expiration seconds") |
| 298 | } |
| 299 | return seconds, nil |
| 300 | } |
| 301 | |
| 302 | func (c *AuthConfig) optionalTimestamp(path []string) (*time.Time, error) { |
| 303 | value, err := c.cfg.Get(path) |
no test coverage detected