feat(config): warn on invalid environment variable values #168

Merged
fuzzy merged 1 commit from feature/warn-invalid-env into main 2026-07-15 17:40:32 +00:00
Owner

What

When an environment variable has an unparseable value, print a warning to stderr instead of silently dropping it.

Why

Users setting PGET_CONCURRENCY=abc would silently fall back to the default or CLI flag, with no indication anything was wrong.

Implementation

Each parsing branch in applyEnvOverrides now has an else clause that prints:

warning: invalid PGET_CONCURRENCY value "abc", ignoring

Affected env vars: PGET_CONCURRENCY, PGET_RETRIES, PGET_TIMEOUT, PGET_QUIET, PGET_VERBOSE, PGET_RESUME, PGET_RATE.

Testing

  • Manual: PGET_CONCURRENCY=abc ./pget <url> prints warning
  • go test -race ./... — all pass
  • golangci-lint run — 0 issues

Breaking Changes

None

Closes #123

## What When an environment variable has an unparseable value, print a warning to stderr instead of silently dropping it. ## Why Users setting `PGET_CONCURRENCY=abc` would silently fall back to the default or CLI flag, with no indication anything was wrong. ## Implementation Each parsing branch in `applyEnvOverrides` now has an else clause that prints: ``` warning: invalid PGET_CONCURRENCY value "abc", ignoring ``` Affected env vars: PGET_CONCURRENCY, PGET_RETRIES, PGET_TIMEOUT, PGET_QUIET, PGET_VERBOSE, PGET_RESUME, PGET_RATE. ## Testing - [x] Manual: `PGET_CONCURRENCY=abc ./pget <url>` prints warning - [x] `go test -race ./...` — all pass - [x] `golangci-lint run` — 0 issues ## Breaking Changes None Closes #123
feat(config): warn on invalid environment variable values
All checks were successful
Test and Release / test (pull_request) Successful in 2m31s
Test and Release / lint (pull_request) Successful in 3m37s
ace1051397
applyEnvOverrides now prints a warning to stderr when env var values
fail to parse, e.g.: warning: invalid PGET_CONCURRENCY value abc, ignoring

Closes #123
fuzzy scheduled this pull request to auto merge when all checks succeed 2026-07-15 17:39:42 +00:00
the.auditor left a comment

Review: APPROVED

Verification

  • go vet ./... passes
  • go build ./... passes
  • go test -race ./... all pass

Change

  • internal/config/config.go — 7 else clauses added in applyEnvOverrides to print warning: invalid PGET_* value "...", ignoring on parse failure

Affects: PGET_CONCURRENCY, PGET_RETRIES, PGET_TIMEOUT, PGET_QUIET, PGET_VERBOSE, PGET_RESUME, PGET_RATE

Closes #123 on merge.

## Review: APPROVED ### Verification - `go vet ./...` — ✅ passes - `go build ./...` — ✅ passes - `go test -race ./...` — ✅ all pass ### Change - `internal/config/config.go` — 7 `else` clauses added in `applyEnvOverrides` to print `warning: invalid PGET_* value "...", ignoring` on parse failure Affects: PGET_CONCURRENCY, PGET_RETRIES, PGET_TIMEOUT, PGET_QUIET, PGET_VERBOSE, PGET_RESUME, PGET_RATE Closes #123 on merge.
fuzzy merged commit ace1051397 into main 2026-07-15 17:40:32 +00:00
fuzzy deleted branch feature/warn-invalid-env 2026-07-15 17:40:32 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/pget!168
No description provided.