Skip to content

Implement fetch subcommand and internal/fetch package #4

@mikkeldamsgaard

Description

@mikkeldamsgaard

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

  • internal/fetch/fetch.go with HTTP client, auth header, file writing
  • internal/fetch/fetch_test.go with tests for: success, auth header, missing URL, path traversal, TLS
  • internal/cmd/fetch.go with full subcommand implementation
  • internal/cmd/fetch_test.go with command-level tests
  • Registered in cmd/initium/main.go
  • docs/usage.md updated
  • CHANGELOG.md updated
  • All tests pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions