feat(config): warn on invalid environment variable values #168
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thwap/pget!168
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/warn-invalid-env"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
When an environment variable has an unparseable value, print a warning to stderr instead of silently dropping it.
Why
Users setting
PGET_CONCURRENCY=abcwould silently fall back to the default or CLI flag, with no indication anything was wrong.Implementation
Each parsing branch in
applyEnvOverridesnow has an else clause that prints:Affected env vars: PGET_CONCURRENCY, PGET_RETRIES, PGET_TIMEOUT, PGET_QUIET, PGET_VERBOSE, PGET_RESUME, PGET_RATE.
Testing
PGET_CONCURRENCY=abc ./pget <url>prints warninggo test -race ./...— all passgolangci-lint run— 0 issuesBreaking Changes
None
Closes #123
Review: APPROVED
Verification
go vet ./...— ✅ passesgo build ./...— ✅ passesgo test -race ./...— ✅ all passChange
internal/config/config.go— 7elseclauses added inapplyEnvOverridesto printwarning: invalid PGET_* value "...", ignoringon parse failureAffects: PGET_CONCURRENCY, PGET_RETRIES, PGET_TIMEOUT, PGET_QUIET, PGET_VERBOSE, PGET_RESUME, PGET_RATE
Closes #123 on merge.