Skip to content

The file and where it is read from

Novis reads its configuration from one TOML file named nvs.toml.

nvs reads ./nvs.toml from the working directory. This is the directory where you start the command, which can be different from the directory of the program. If there is no ./nvs.toml, nvs reads nvs.toml in the data folder, .nvsdata next to the nvs program. If there is no file at all, the configuration is empty and valid. Every setting then has its default value. --config <path> reads the named file, and neither nvs.toml is then read. Repeat the option to read several files in order.

A relative path inside a file starts from the directory of that file. This is true for an include, a path in a capability grant, an [[app]] key and a secret file.

Good to know: a key that Novis does not know stops the run before the program starts. The error is E0601, and it names the block and the keys that the block accepts. A setting is always written in a file. No environment variable and no command-line option sets one.

Examples

The examples below run with this configuration file.

nvs.toml
# The program gets its settings from this file.
# The path `notes` is the folder next to this file.
[limits]
memory = "64M"
[capabilities.fs]
read = ["notes"]

Where a setting comes from

<?nvs
// Shows where the settings of a program come from. They all come from one file, `nvs.toml`.
// `memory` is set in the file. This prints `64M`.
echo Core\Config::get('memory'), "\n";
// `wall_time` is not in the file, so `Core\Config::get` returns `null`. This prints `unset`.
echo Core\Config::get('wall_time') ?? 'unset', "\n";
// `nvs.toml` allows reading the `notes` folder next to it. A path in quotes
// starts at the folder of this program, which is the same folder.
echo Core\IO::read('notes/today.txt');
// `Core\Path::fromWorkingDirectory` starts the path at the working directory.
// `notes` there is a different folder. Reading it throws a `RuntimeError`.
try {
Core\IO::read(Core\Path::fromWorkingDirectory('notes/today.txt'));
} catch (RuntimeError $denied) {
echo "not allowed\n";
}
Output
64M
unset
Call the supplier about order 1042.
not allowed