Skip to content

refactor(config): separate source loading from resolution#830

Draft
natalie-o-perret wants to merge 4 commits intomasterfrom
refactor/config-resolution
Draft

refactor(config): separate source loading from resolution#830
natalie-o-perret wants to merge 4 commits intomasterfrom
refactor/config-resolution

Conversation

@natalie-o-perret
Copy link
Copy Markdown
Contributor

@natalie-o-perret natalie-o-perret commented May 5, 2026

Follow-up to #817.

Splits config source loading from resolution into a small, testable layer.

Each source (env vars, config file profile, built-in defaults) is loaded independently into its own struct, then merged by resolve() with one explicit precedence rule:

CLI flags > env vars > config file profile > built-in defaults

Changes:

  • New cmd/config_resolution.go with envSources, fileSources, and resolve(). Replaces envAccountOverrides, useEnvOnlyAccount, and finalizeCurrentAccount.
  • Fix --config vs EXOSCALE_CONFIG precedence: CLI flags now always win. Previously EXOSCALE_CONFIG silently overrode --config because the env-to-flag mapping had no Changed guard.
  • Add EXOSCALE_ZONE support: overrides the default zone from the selected config profile without touching anything else.
  • 11 unit tests covering every precedence rule in resolve().
  • 2 new e2e testscript scenarios for EXOSCALE_ZONE and --config / EXOSCALE_CONFIG precedence.

Testing:

go test ./cmd/...
make build
cd tests/e2e && go test -run TestScriptsLocal -count=1 .

@natalie-o-perret natalie-o-perret force-pushed the refactor/config-resolution branch from 00da573 to 62dede7 Compare May 5, 2026 13:44
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.

1 participant