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:
| Invocation | Behavior |
|---|---|
| ./build/vsi_ngine | Loads 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 Path | Type | Default / Constraints |
|---|---|---|
| engine.backlog | integer | Optional; defaults to 128 (VSI_DEFAULT_BACKLOG). Must be > 0. |
| metrics.enabled | boolean | Optional; defaults to true when omitted. |
| metrics.listen_ip | string | Optional; valid IPv4 or "0.0.0.0". Defaults to "0.0.0.0". |
| metrics.listen_port | integer | Optional; 1..65535. Defaults to 9100. |
| services.forwardProxy.enabled | boolean | Required true to activate Forward Proxy. |
| services.forwardProxy.listen_ip | string | Optional; valid IPv4 or "0.0.0.0". Defaults to "0.0.0.0". |
| services.forwardProxy.listen_port | integer | Required when enabled (1..65535). |
| services.reverseProxy.enabled | boolean | Required true to activate Reverse Proxy. |
| services.reverseProxy.mappings | array | Non-empty array (max 16 entries: VSI_MAX_RP_MAPPINGS). |
| mappings[].listen_ip | string | Optional; valid IPv4 or "0.0.0.0". Defaults to "0.0.0.0". |
| mappings[].listen_port | integer | Required (1..65535). |
| mappings[].target | string | Required 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().