Summary
Implement the fetch subcommand and internal/fetch package for fetching secrets/config from HTTP(S) endpoints and writing them to files.
Requirements
internal/fetch package:
- HTTP GET with configurable timeout
- Optional
Authorization header sourced from an environment variable (not a flag, to avoid leaking in process lists)
- Response body written to file within workdir
- Integration with
internal/retry for retries
- Integration with
internal/safety for path validation
fetch subcommand:
--url flag: target URL (required)
--output flag: relative output path within workdir (required)
--workdir flag: output directory (default /work)
--auth-env flag: name of env var containing the Authorization header value (e.g., VAULT_TOKEN)
--insecure-tls flag: skip TLS verification
--follow-redirects flag: follow redirects, but dont allow cross site redirect
--allow-cross-site-redirects flag: allow cross site redirect, only usable with --follow-redirects
- Retry support with same flags as
wait-for
Acceptance Criteria
Summary
Implement the
fetchsubcommand andinternal/fetchpackage for fetching secrets/config from HTTP(S) endpoints and writing them to files.Requirements
internal/fetchpackage:Authorizationheader sourced from an environment variable (not a flag, to avoid leaking in process lists)internal/retryfor retriesinternal/safetyfor path validationfetchsubcommand:--urlflag: target URL (required)--outputflag: relative output path within workdir (required)--workdirflag: output directory (default/work)--auth-envflag: name of env var containing the Authorization header value (e.g.,VAULT_TOKEN)--insecure-tlsflag: skip TLS verification--follow-redirectsflag: follow redirects, but dont allow cross site redirect--allow-cross-site-redirectsflag: allow cross site redirect, only usable with --follow-redirectswait-forAcceptance Criteria
internal/fetch/fetch.gowith HTTP client, auth header, file writinginternal/fetch/fetch_test.gowith tests for: success, auth header, missing URL, path traversal, TLSinternal/cmd/fetch.gowith full subcommand implementationinternal/cmd/fetch_test.gowith command-level testscmd/initium/main.godocs/usage.mdupdatedCHANGELOG.mdupdated