configcmd: config show, Doctor, KnownKey and a Layered hook
"config show [--json] [--show-secrets]" prints the configuration with the origin of every value (secrets redacted), for every program. Spec.Layered lets a program whose configuration is merged from several inputs (family file, a section of it, its own file -- the yamase family) run path, validate and show over all layers, with its own unknown-option rules; unknown options are warnings there. Doctor(report, spec, explicit) is the config part of a doctor command. UnknownKey carries the layer it is in; KnownKey tells whether a dotted key is an option of a config struct. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
185211e304
commit
fa52990e3e
7 files changed
+758
-11
No files matched your search
@@ -19,9 +19,17 @@ type UnknownKey struct {
|
||||
// entries of a list are "listen[1].tls".
|
||||
Key string
|
||||
Line int
|
||||
// Layer names the layer the key is in, for a layered configuration
|
||||
// (LayerInfo.Name); "" for a single file.
|
||||
Layer string
|
||||
}
|
||||
|
||||
func (k UnknownKey) String() string { return fmt.Sprintf("%s (line %d)", k.Key, k.Line) }
|
||||
func (k UnknownKey) String() string {
|
||||
if k.Layer != "" {
|
||||
return fmt.Sprintf("%s (%s, line %d)", k.Key, k.Layer, k.Line)
|
||||
}
|
||||
return fmt.Sprintf("%s (line %d)", k.Key, k.Line)
|
||||
}
|
||||
|
||||
// UnknownKeys lists the keys of raw that schema (the program's
|
||||
// configuration struct, e.g. config.Config{}) has no field for, by its
|
||||
|
||||
Reference in new issue
Block a user