Auditing a tree
nvs config check and nvs config dump show what a configuration contains, and they run no program.
nvs config check reads the file and every file that it includes. It prints one line with the number of files, settings, overrides and warnings, such as ok: 1 file, 4 directives set, 0 overrides, 0 warnings. The exit status is not 0 when the configuration has an error.
nvs config dump prints every key that is in effect, one key on each line. That is each key a file sets, and the default value of every other key. --origin adds the file that set each key and the file that it replaced. A default value shows default. --toml prints the keys that the files set as one TOML document.
Good to know: the dump prints the full name of each key. A key in the first [[app]] block starts with app.0., for example app.0.root.
Examples
The examples below run with this configuration file.
# Every program on this server gets these limits.[limits]memory = "256M"wall_time = "30s"
# Every program in this directory gets a longer time limit.[[app]]root = "."
[app.limits]wall_time = "120s"What the dump shows and what a program gets
<?nvs// Shows how the output of `nvs config dump` matches the settings a program gets when it runs.
// `nvs config check nvs.toml` reads the file and runs nothing. It prints this line and exits with `0`:// ok: 1 file, 4 directives set, 0 overrides, 0 warnings
// `nvs config dump nvs.toml` prints every setting. These lines are the settings that the file sets:// app.0.limits.wall_time = "120s"// app.0.root = "."// limits.memory = "256M"// limits.wall_time = "30s"// Every other line is a default value, such as `log.target = "stderr"`. `--origin` adds the file, or `default`.
// This program is in the directory of block `app.0`, so its time limit is the block's value.// This prints `time limit: 120s`.echo 'time limit: ', Core\Config::get('limits.wall_time') ?? '(unset)', "\n";
// The block does not set `memory`, so the value from `[limits]` is used.// This prints `memory: 256M`.echo 'memory: ', Core\Config::get('limits.memory') ?? '(unset)', "\n";time limit: 120smemory: 256M