Skip to content

feat: add check-config subcommand for offline config validation - #80

Open
cxdy wants to merge 1 commit into
linode-obs:mainfrom
cxdy:feat/check-config
Open

feat: add check-config subcommand for offline config validation#80
cxdy wants to merge 1 commit into
linode-obs:mainfrom
cxdy:feat/check-config

Conversation

@cxdy

@cxdy cxdy commented Jul 23, 2026

Copy link
Copy Markdown
Member

Adds latr check-config so 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

# Classic single file or glob
latr check-config --config config.yaml
latr check-config --config 'configs/*.yaml'

# Multi-file: process settings + token files
latr check-config --process process.yaml --config team-a.yml --config team-b.yml

# Directory: `_process.yaml` + other `*.yml`/`*.yaml` token files
latr check-config --dir path/to/config-dir

Copilot AI review requested due to automatic review settings July 23, 2026 10:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-config CLI 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-config behaviors.

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.yml is 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,
)
}
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