Skip to content

Feat: Layered Configuration (Env Vars + .structalignrc)#69

Merged
peczenyj merged 2 commits into
develfrom
feat/layered-config
May 28, 2026
Merged

Feat: Layered Configuration (Env Vars + .structalignrc)#69
peczenyj merged 2 commits into
develfrom
feat/layered-config

Conversation

@peczenyj
Copy link
Copy Markdown
Owner

Implemented layered configuration as per the v0.7.0 roadmap.

Features

  • Environment Variables: Support for STRUCTALIGN_ (e.g., STRUCTALIGN_SORT=true).
  • RC Files: Support for .structalignrc in both home and the current directory.
  • Precedence: CLI flags > Environment variables > CWD config > Home config.
  • Disable RC: New -no-rc flag to skip loading configuration files.

Technical Details

  • Added internal/config for standalone parsing and env-name logic.
  • Updated app.Run to apply configuration layers via fs.Set before fs.Parse.
  • Detected -no-rc and retro theme flags early using scanEarlyFlags.

Tested with task ci and added a new integration test internal/app/config_test.go to verify the layering logic.

This PR adds support for persistent defaults via environment variables and configuration files.

- New internal/config package for RC file parsing and env derivation.
- Support for STRUCTALIGN_<FLAG> environment variables.
- Support for .structalignrc files in Home and CWD (CWD > Home).
- New -no-rc flag to disable RC loading.
- Precedence: CLI > Env > CWD RC > Home RC > Default.

Documentation updated in README.md and AGENTS.md.
@peczenyj peczenyj self-assigned this May 28, 2026
@peczenyj peczenyj merged commit 7d7556c into devel May 28, 2026
11 checks passed
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