config init now leaves out the test sources unless given --all
A section tagged init:"hidden" isn't written to the file config init generates; fts_mock and sleeper are. config init --all writes them too. They still load, and the config commands read and set them as before.
This commit is contained in:
1 parent
f467c6c7da
commit
b0f93fd437
8 files changed
+131
-21
No files matched your search
@@ -267,6 +267,10 @@ per key:
|
||||
of the configuration.
|
||||
- `default:"value"` is the field's default, parsed as if it were a string
|
||||
passed to `SetValue` (e.g. `"10m"`, `"true"`).
|
||||
- `init:"hidden"` on a nested section's field leaves the section out of the
|
||||
file `config init` writes, unless `--all` is given (`InitDefaults`). The
|
||||
test sources, `fts_mock` and `sleeper`, have it. The section is otherwise
|
||||
as any other: loaded, and read and set by the `config` commands.
|
||||
- A tagged field whose type is a struct is a nested section, addressed as
|
||||
`section.key`. An embedded struct has its fields promoted, as Go does;
|
||||
every source embeds `JSCSourcesSource` for `enabled` and `interval`.
|
||||
@@ -324,7 +328,8 @@ To add a new section:
|
||||
`JSCRateLimitRule`, has no constant and passes `""` to `flattenOf`.
|
||||
2. Add the struct as a tagged field of its parent: `JobSearchConfig` in
|
||||
`config.go`, or `JSCSources` in `conf_sources.go` for a source,
|
||||
etc. The field's `cfg` tag must match the `JSCK*` constant.
|
||||
etc. The field's `cfg` tag must match the `JSCK*` constant. Add
|
||||
`init:"hidden"` if it's only for testing.
|
||||
|
||||
Nothing in `section.go` needs changing.
|
||||
|
||||
|
||||
Reference in new issue
Block a user