ResolveTimeout returns an explicit user timeout when present, otherwise fallback.
(fallback time.Duration)
| 77 | |
| 78 | // ResolveTimeout returns an explicit user timeout when present, otherwise fallback. |
| 79 | func ResolveTimeout(fallback time.Duration) time.Duration { |
| 80 | if timeout == "" { |
| 81 | return fallback |
| 82 | } |
| 83 | |
| 84 | parsed, err := time.ParseDuration(timeout) |
| 85 | if err != nil || parsed <= 0 { |
| 86 | return fallback |
| 87 | } |
| 88 | |
| 89 | return parsed |
| 90 | } |
| 91 | |
| 92 | // IsDryRun returns whether dry-run mode is enabled |
| 93 | func IsDryRun() bool { |
no outgoing calls