The blocks the binary accepts
Every setting in nvs.toml is written inside a block, and Novis accepts only the blocks that it knows.
A block is a TOML table such as [limits], or a list of tables such as [[app]]. [limits] and [limits.hard] contain the resource limits. [capabilities] contains the grants. [[app]] contains the settings of one application, and [[include]] reads other files. Other blocks configure a named database ([db.<name>]), an LDAP directory ([ldap.<name>]), a mail server ([mail.<name>]), a mailbox ([imap.<name>]), a file server ([file_transfer.<name>]), the caches, the log, HTTP, the web server and scheduled scripts.
A setting outside a block, an unknown key and an unknown block with a setting in it all give the error E0601. Novis ignores an empty unknown block and gives the warning W1024. Novis keeps every key that it accepts. nvs config dump prints each one, and a program reads one with Core\Config::get.
Good to know: Novis keeps an accepted key even when the command you run does not use it. For example, nvs run keeps wall_time, but it does not stop a program that runs longer than that.
Examples
The examples below run with this configuration file.
# Each setting is inside a block, such as `[limits]` or `[log]`.# A block or a key that Novis does not know stops the program before it starts.[limits]memory = "128M"
[log]level = "info"
[mail.orders]host = "smtp.example.com"port = 587from = "shop@example.com"Reading settings from several blocks
<?nvs// Shows how a program reads settings from different blocks of `nvs.toml`.
// A name is the block and the key, joined by dots. This prints `info`.echo Core\Config::get('log.level'), "\n";
// A block with a name, such as `[mail.orders]`, adds that name.// These lines print `smtp.example.com` and `587`.echo Core\Config::get('mail.orders.host'), "\n";echo Core\Config::get('mail.orders.port'), "\n";
// The file has no `[mail.news]` block, so the result is `null`. This prints `none`.echo Core\Config::get('mail.news.host') ?? 'none', "\n";infosmtp.example.com587noneChangelog
| Version | Change |
|---|---|
0.0.6 | A [file_transfer.<name>] block names a server, and [capabilities.file_transfer] connect lists the blocks a program may open. An sftp block needs the server's host key in host_key or known_hosts_file. An ftp block allows only an anonymous sign-in, so a password is never sent unencrypted. |
