Skip to content
Docs / Configuration

Configuration

Complete reference for config.json fields, CLI arguments, IPv4 bind validation, and port conflict rules.

Configuration Resolution Order

Configuration parsing is handled by vsi_config_parse_args() in CoreEngine/config/vsi_config.c:

InvocationBehavior
./build/vsi_ngineLoads config.json from the current working directory.
./build/vsi_ngine -c <path> / --config <path>Loads the JSON configuration file at <path>.
./build/vsi_ngine <port>Legacy CLI override: starts Forward Proxy on 0.0.0.0:<port> (defaults to 8085 if invalid) and Metrics on 0.0.0.0:9100.
./build/vsi_ngine -M1 <port> <target_url> [-M2 ...]Legacy CLI override: starts Reverse Proxy with up to 16 -M<n> port-to-target mappings on 0.0.0.0.

JSON Schema (config.json)

Below is a complete config.json example showing every supported object and field parsed by vsi_config_load_json(). At least one service under "services" must have "enabled": true.

config.json
{
"engine": {
"backlog": 128
},
"metrics": {
"enabled": true,
"listen_ip": "127.0.0.1",
"listen_port": 9100
},
"services": {
"forwardProxy": {
"enabled": true,
"listen_ip": "0.0.0.0",
"listen_port": 8085
},
"reverseProxy": {
"enabled": true,
"mappings": [
{
"listen_ip": "0.0.0.0",
"listen_port": 8081,
"target": "http://127.0.0.1:3000"
},
{
"listen_ip": "0.0.0.0",
"listen_port": 8083,
"target": "http://localhost:8080"
}
]
}
}
}

Field Reference & Defaults

JSON PathTypeDefault / Constraints
engine.backlogintegerOptional; defaults to 128 (VSI_DEFAULT_BACKLOG). Must be > 0.
metrics.enabledbooleanOptional; defaults to true when omitted.
metrics.listen_ipstringOptional; valid IPv4 or "0.0.0.0". Defaults to "0.0.0.0".
metrics.listen_portintegerOptional; 1..65535. Defaults to 9100.
services.forwardProxy.enabledbooleanRequired true to activate Forward Proxy.
services.forwardProxy.listen_ipstringOptional; valid IPv4 or "0.0.0.0". Defaults to "0.0.0.0".
services.forwardProxy.listen_portintegerRequired when enabled (1..65535).
services.reverseProxy.enabledbooleanRequired true to activate Reverse Proxy.
services.reverseProxy.mappingsarrayNon-empty array (max 16 entries: VSI_MAX_RP_MAPPINGS).
mappings[].listen_ipstringOptional; valid IPv4 or "0.0.0.0". Defaults to "0.0.0.0".
mappings[].listen_portintegerRequired (1..65535).
mappings[].targetstringRequired target URL (e.g. "http://127.0.0.1:3000"; port defaults to 80 if omitted).

IPv4 & Port Conflict Validation

Before starting any listener, vsi_config_validate_ports() checks every enabled endpoint across forwardProxy, all reverseProxy mappings, and metrics. Two endpoints conflict if they share the same port and either bind the same IPv4 address or either binds the wildcard address 0.0.0.0.

Config files larger than 1 MB (1024 * 1024 bytes) are rejected by read_entire_file().