feat(config): add YAML config file support#22
Merged
Conversation
9b96116 to
fe32cb2
Compare
Phase 5 — make ~/.nodeup/config.yaml a first-class config source
alongside env vars and CLI flags. Settings live in internal/config
(no cobra or detector imports) and resolve through a four-layer
precedence chain: defaults < file < env < CLI flags.
Highlights:
- internal/config: Config struct + Default + Validate + per-key
SetByKey. FileOverlayFromNode walks the YAML tree so explicit
zeros like `track.lts: false` round-trip faithfully — yaml.v3
alone can't distinguish "absent" from "zero". Save() is atomic
(temp + rename, 0600) and refuses to persist invalid configs.
Load() applies defaults to a missing file silently.
- internal/config/env.go: NODEUP_MANAGER, NODEUP_TRACK_LTS,
NODEUP_TRACK_CURRENT, NODEUP_PACKAGES_MIGRATE,
NODEUP_PACKAGES_STRATEGY, NODEUP_CACHE_TTL. Parse errors include
the variable name so env typos surface immediately.
- internal/cli: new `nodeup config` subcommands — show (YAML
round-trip), get <key>, set <key> <value> (validates before
writing), init [--force] (refuses to overwrite without --force).
- internal/cli/upgrade.go: now reads effective config via
loadConfigOrDefault(); --manager flag still wins; cfg.Packages
.Migrate replaces the hard-coded true so users can opt out.
- scripts/issue-workflow.sh: gh-based issue → branch → PR → squash
helper. Bash regex parser fixed (space-separated alternations
aren't valid ERE — wrapped in a group with | separators).
- docs/configuration.md: schema + precedence + env var reference
rewritten as the source of truth for the field set.
- README, CHANGELOG: status table updated (Phase 5 ✅);
Configuration section now shows the YAML shape and the
config {show,get,set,init} subcommands.
- .gitignore: ignore tooling session metadata.
Tests cover the four-layer resolve ordering, env-var overlays,
file-overlay set-flag tracking, atomic save+load round-trip, and
the dotted-key get/set surface.
fe32cb2 to
01faa83
Compare
|
✔️ 01faa83 - Conventional commits check succeeded. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Linked issues
Closes #0
Type of change
feat— see the title; check the matching box below- [ ]
fix- [ ]
docs- [ ]
style- [ ]
refactor- [ ]
perf- [ ]
test- [ ]
build- [ ]
ci- [ ]
chore- [ ]
revertChecklist
feat(config): subject)make cilocally and it passesdocs/, inline godoc)Scope notes / things reviewers may want to look at
Screenshots / output