Skip to content

feat(config): add environment variable loader for pipeline config structs#117

Open
fxsml wants to merge 1 commit into
developfrom
claude/env-var-config-QiFnE
Open

feat(config): add environment variable loader for pipeline config structs#117
fxsml wants to merge 1 commit into
developfrom
claude/env-var-config-QiFnE

Conversation

@fxsml
Copy link
Copy Markdown
Owner

@fxsml fxsml commented Feb 10, 2026

Summary

  • Add config.Loader for loading environment variables into config structs
  • Supports {PREFIX}_{STAGE}_{FIELD} naming convention (e.g., GOPIPE_TRANSFORM_CONCURRENCY)
  • Handles nested structs, embedded fields, and all primitive types including time.Duration
  • Overlay pattern: only set env vars override, preserving programmatic defaults

Test Plan

  • Unit tests cover all field types and edge cases (628 lines)
  • make check passes

Introduce a reflection-based config.Loader that populates config structs
from environment variables without requiring any external dependencies.

Naming convention: {PREFIX}_{STAGE}_{FIELD}
- Configurable prefix (default GOPIPE)
- Stage name uppercased and sanitized (hyphens/spaces → underscores)
- Field names converted from CamelCase to UPPER_SNAKE_CASE
- Named nested structs add their field name as a path segment
  (e.g. EngineConfig.RouterPool.Workers → GOPIPE_ENGINE_ROUTER_POOL_WORKERS)
- Anonymous (embedded) structs are flattened
- Functions, interfaces, and other unsupported types are skipped

Supports: string, bool, int*, uint*, float*, time.Duration.

https://claude.ai/code/session_01Suk1iCBqUgxPBDEhy7n4wW
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants