Configuration
The VILLASnode configuration consists of a a single file.
For a collection of example configuration files see: https://github.com/VILLASframework/node/tree/master/etc/.
File format
VILLASnode currently supports two config file formats:
Note: Consider using the villas conf2json
command to migrate your old configurations to JSON.
Top-level Structure
At the top level, the configuration file consists of these sections:
OpenAPI / JSON Schema Specification
There exists a formal description of the configuration file as a JSON Schema / OpenAPI 3.0 specification.
The remaining part of this subsection shows a HTML version of this schema rendered by Redoc:
Example
VILLASnode comes with a lot of existing configurations which can be used for inspiration: https://github.com/VILLASframework/node/tree/master/etc/examples
# Global configuration settings go here
stats = 2
# Webserver / API config
http = {
port = 8081
}
# Logging
logging = {
level = "debug
}
# Node definitions
nodes = {
test_node = {
in = {
signals = {
count = 12
type = "float"
}
}
}
}
# Path Mapping
paths = (
{
in = "test_node",
out = "test_node"
}
)
Tips & Tricks
Use environment variables in your configuration
VILLASnode substitutes any environment variables in you JSON and libconfig configuration files.
To replace environment variables you must use the following syntax within any string value of your config: ${MYENV_VAR}
.
Note: Non-string values can currently not be substituted by environment variables!
Example
nodes = {
file_node = {
uri = "${FILE_PATH}"
}
}
Include other files into your configuration
VILLASnode can include other files into you configuration. This allows you to better structure and reuse parts of your configuration (e.g. the node definitions).
File inclusion is handled via a special key in JSON objects named @include
.
The value of this key must point to an existing file on your file system.
Note: libconfig supports inclusion of other files out of the box via @include directives. So this tip is mostly useful for JSON configuration files.
Example
{
"gain": 1.45,
"t_dt": 50e-6
}
{
"test_node": {
"type": "file",
"in": {
"signals": {
"count": 12,
"type": "float"
}
}
},
"signal_node": {
"signal": "random",
"in": {
"hooks": [
{
"type": "lua",
"script": "myscript.lua",
"@include": "params.json"
}
]
}
}
}
{
"nodes":{
"@include": "nodes.json"
},
"paths": [
{
"in": "signal_node",
"out": "test_node"
}
]
}