Skip to content

feat: add NewConfigCommand, and document the config-key vocabulary - #24

Merged
patdowney merged 1 commit into
feat/service-loggerfrom
feat/config-command
Nov 14, 2026
Merged

patdowney merged 1 commit into
feat/service-loggerfrom
feat/config-command

Conversation

@patdowney

Copy link
Copy Markdown
Contributor

Summary

  • cli.NewConfigCommand(kind, newConfig, opts...) returns a config command with validate, example and schema subcommands. validate checks a file without starting the service and reports every unknown key (with its full path) and every setting Validate rejects, together. example and schema are generated from the config struct's mapstructure keys and desc tags; WithConfigExample and WithConfigSchema let a service supply richer ones generated at build time.
  • doc/config-keys.md records the key vocabulary Dioad services share, and how keys, flags and environment variables relate.
  • examples/config-command is a runnable service using the command (its run command prints and exits; its tests run each subcommand). ExampleNewConfigCommand runs validate against an in-memory config.

Not included: the optional key-alias mechanism. The reflection-based example and schema can't read doc comments; the struct walk the issue mentions lifting into dioad/config does not exist there yet.

Fixes #19

Stacked on the service-logger PR (this base branch).

🤖 Generated with Claude Code

https://claude.ai/code/session_01SS4MAwAn85D1gkEzLtjYaZ

NewConfigCommand returns a config command with validate, example and schema
subcommands for a service's config type. validate checks a file without
starting the service and reports every unknown key, with its full path, and
every setting Validate rejects, together. example and schema are generated
from the config struct's mapstructure keys and desc tags, or supplied by the
service when it generates richer ones at build time.

doc/config-keys.md records the key vocabulary Dioad services share, taken
from connect's convention, and how keys, flags and environment variables
relate. examples/config-command is a runnable service using the command.

The optional key-alias mechanism in the issue is not included.

Fixes #19

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SS4MAwAn85D1gkEzLtjYaZ
@patdowney
patdowney added this pull request to stack #25 November 14, 2026 23:37
@patdowney
patdowney merged commit fab8c05 into master Nov 14, 2026
4 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.

Add a config validate/example/schema command and a documented config-key vocabulary

1 participant