feat: add check-config subcommand for offline config validation - #80
Open
cxdy wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an offline latr check-config subcommand so CI/local checks can validate configuration using the same parse/default/validate code paths as runtime, while avoiding any Linode/Vault side effects. This introduces multi-file and directory-based config composition helpers with accompanying unit tests, and documents the new workflow in the README.
Changes:
- Add
check-configCLI subcommand (new flags/modes + exit codes) and update top-level CLI usage handling. - Introduce config composition/loading helpers for multi-file merges and
_process.(yml|yaml)+ token-file directory layouts, plus validation helpers (e.g., duplicate label detection). - Add README documentation and unit tests covering the new config composition and
check-configbehaviors.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents latr check-config usage patterns, exit codes, and validation semantics. |
| internal/config/compose.go | Adds multi-file/dir composition loaders and a Check path for offline validation. |
| internal/config/compose_test.go | Adds unit tests for directory layouts, merge order, vault-credential requirements, and duplicate-label validation. |
| cmd/latr/main.go | Adds subcommand dispatch (check-config, version, help) while keeping legacy daemon flags working. |
| cmd/latr/check_config.go | Implements latr check-config flag parsing, mode selection, and exit-code behavior. |
Comments suppressed due to low confidence (2)
internal/config/compose.go:122
- This error says the directory is missing
_process.yaml, but LoadDir also accepts_process.yml. Consider mentioning both so users don’t hunt for the wrong filename.
return nil, fmt.Errorf(
"directory %s: missing process config %s",
dir,
ProcessConfigFileName,
)
internal/config/compose.go:129
- This message refers to only
_process.yaml, but_process.ymlis also treated as the process config file. Updating the wording will make the directory layout expectations clearer.
return nil, fmt.Errorf(
"directory %s: need at least one token config file (*.yml / *.yaml) besides %s",
dir,
ProcessConfigFileName,
)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+102
to
+110
| if processPath != "" { | ||
| return nil, fmt.Errorf( | ||
| "directory %s: multiple process config files (%s and %s); keep a single %s", | ||
| dir, | ||
| filepath.Base(processPath), | ||
| name, | ||
| ProcessConfigFileName, | ||
| ) | ||
| } |
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.
Adds
latr check-configso CI and local checks can validate configuration with the same load/default/validate logic as the running daemon, with no Linode or Vault side effects.Usage