aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-12-02 16:24:19 +0000
committertv <tv@krebsco.de>2026-12-02 17:08:52 +0000
commit2be9ca2b75d099a9ca04078f2182acda074ed270 (patch)
treeacd772e1873e566e2022f068628179bbd53eb8e9 /docs
parent1de11da61a106187748c4b79e1d7b63e3b9d172f (diff)
config: a configuration names importers of its own
[meta.importer] in a file, or --meta-importer-NAME IMPORTER, names an importer: NAME:REST, { NAME = "REST" } and a placeholder of that name are then that importer, with REST as its variable `name`. So what would be built in for one tool, pass:NAME, is written by who uses it, once: pass = { command = ["pass", "show", "$(var:name)"] }. A name counts in every file and argument, wherever it is given; of two of one name, the later source's. What follows the name goes in as every variable does, as data. One named may be defined through others, not through itself. `meta` at the top of a configuration file is what the configuration says about itself. The argument is spelled as every option's, the table's keys joined with `-`; as its name is the configuration's, it is taken off the command line before the command reads it.
Diffstat (limited to 'docs')
-rw-r--r--docs/configuration.md51
1 files changed, 51 insertions, 0 deletions
diff --git a/docs/configuration.md b/docs/configuration.md
index 41a4aff..79e5965 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -269,6 +269,57 @@ continuum --config /etc/continuum.toml --alias env:HOSTNAME --seeds cmd+json:'my
Imports are read once, at start.
+### Naming importers
+
+A configuration can name importers of its own, under `[meta.importer]`: what would
+otherwise be written out at every use, a secret store's command for one, is written
+once.
+
+```toml
+[meta.importer]
+pass = { command = ["pass", "show", "$(var:name)"] }
+secrets = "cmd:secrets $(env:HOSTNAME) show $(var:name)"
+kept = { file = "/run/secrets/$(var:name)" }
+```
+
+Each is an importer as above, a table or the text an argument takes (`cmd:…`, `file:…`,
+`env:…`), with the variable `name` for what follows the name where it is used:
+
+```toml
+tor-key = { pass = "continuum/tor" }
+alias = "node-$(secrets:alias)"
+```
+
+```sh
+continuum --tor-key pass:continuum/tor
+```
+
+So `NAME:REST` on the command line, `{ NAME = "REST" }` in a file and `$(NAME:REST)` in
+a placeholder are that importer, and `+raw` and `+json` (`format` in a table) say how
+its content is read, as with the kinds built in: the importer named takes no format
+itself. What follows the name goes in as every variable does: as it is, one argument,
+one word of a shell command, never as something to run. It may hold placeholders, and
+an importer may be defined through others named, but not through itself.
+
+A name is small letters, digits and `-`, a letter first, and none of `env`, `file`,
+`cmd`, `command`, `var`, `literal` and `format`. Where it isn't named, `pass:x` is
+what it was before: text on the command line, an unknown key in a file.
+
+On the command line it is named as every option is, the table's keys joined with `-`:
+`--meta-importer-NAME IMPORTER`, the importer as an argument takes it:
+
+```sh
+continuum --meta-importer-pass 'cmd:pass show $(var:name)' --tor-key pass:continuum/tor
+```
+
+A name counts in every file and argument of the configuration, wherever it is given:
+one a later file names is known in an earlier one. Of two of one name, the later
+source's counts: a file's own over its includes', a later file's over an earlier
+one's, an argument's over them all. Naming an importer gives whoever writes the
+configuration nothing they lack: they can write the command where it is used as well.
+
+Under `meta` is what a configuration says about itself; `importer` is all of it.
+
## Checking the configuration
`--print-config` prints the effective configuration as JSON and exits: every option