[io]
io.temp_root
The directory in which Novis creates every temporary directory that a program requests.
A program that needs temporary files requests a temporary directory. Novis creates all of them in one root directory, and [io] temp_root sets that root. You can use a fast disk, a volume with free space, or a path that a container mounts.
When the key is not set or is an empty string, Novis uses the tmp folder in its data folder, .nvsdata next to the nvs program. Novis creates it, and only the account that runs nvs can open it.
When a script ends, Novis deletes the temporary directories that the script created. When the server starts, Novis deletes what a crashed process left in the root. Do not set the root to a directory that other programs write to.
Good to know: only the configuration file can set this key. You can change it while the server runs, and the next temporary directory is created in the new root.
Only nvs.toml sets this key. A request may not change it.
A change in the file takes effect a few seconds after you save it. The server does not restart.
The examples below run with this configuration file.
# Temporary directories are deleted when a run ends.[debug]keep_temporary = falseWhere every scratch directory is created
<?nvs// This program shows where Novis creates temporary directories, and who may change that place.
// Nothing sets `[io] temp_root`, so Novis uses the `tmp` folder in its data folder, `.nvsdata`.// The full path differs on each machine, so this prints only the last folder, `tmp`.echo 'root folder: ', Core\Path::fileName(Core\Config::get('io.temp_root') ?? ''), "\n";
// `Core\Config::set('io.temp_root', ...)` does not compile,// because a program may not change `io.temp_root`.
// This program keeps the name in a variable. The compiler does not check a variable, so `set` runs and returns `false`.string $root = 'io.temp_root';echo 'move it: ', Core\Config::set($root, '/tmp/somewhere-of-mine') ? 'yes' : 'no', "\n";
// A program also cannot keep its temporary directories after it ends.// Only the configuration file can set `[debug] keep_temporary`.string $keep = 'debug.keep_temporary';echo 'keep them: ', Core\Config::set($keep, 'true') ? 'yes' : 'no', "\n";echo 'kept today: ', Core\Config::get('debug.keep_temporary') ?? '(nothing)', "\n";
// You can change `[io] temp_root` in the configuration file while the server// runs. The next temporary directory is then created in the new root.root folder: tmpmove it: nokeep them: nokept today: falseChangelog
| Version | Change |
|---|---|
0.0.6 | The page of each setting says whether a request may change it with Core\Config::set. A page for a block lists the settings in it that a request may change. |
