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
@@ -74,12 +74,12 @@ Ignored: x
|
||||
t.Fatal(err)
|
||||
}
|
||||
want := []UnknownKey{
|
||||
{"log-levle", 2},
|
||||
{"listen[0].tsl", 5},
|
||||
{"storage.mailstore.rot", 9},
|
||||
{"backends.inbound.extra", 11},
|
||||
{"throttle.enabeld", 15},
|
||||
{"Ignored", 18},
|
||||
{Key: "log-levle", Line: 2},
|
||||
{Key: "listen[0].tsl", Line: 5},
|
||||
{Key: "storage.mailstore.rot", Line: 9},
|
||||
{Key: "backends.inbound.extra", Line: 11},
|
||||
{Key: "throttle.enabeld", Line: 15},
|
||||
{Key: "Ignored", Line: 18},
|
||||
}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Fatalf("UnknownKeys =\n%v\nwant\n%v", got, want)
|
||||
|
||||
Reference in new issue
Block a user