Developer Tools

vconfig

Merges configuration held in plain maps, and looks settings up by name.

Released v1.0.0 · 2026-09-28
Import
use "stdlib/config.ven"

Including nested keys such as db.port.

vconfig.ven
config = new_map()
set_nested(config, "db.port", 9999)
print get_nested(config, "db.port")
:: 9999
Reference (5 functions)

API reference

merge_configs(base, override)

Deep-merges override onto base, giving overrides values priority.

base = new_map()
map_set(base, "db", new_map())
map_set(map_get(base, "db"), "host", "localhost")
override = new_map()
override_db = new_map()
map_set(override_db, "port", 5432)
map_set(override, "db", override_db)
merge_configs(base, override)
:: {"db": {"host": "localhost", "port": 5432}}

get_nested(config, dotted_path)

config = new_map()
map_set(config, "db", new_map())
map_set(map_get(config, "db"), "host", "localhost")
get_nested(config, "db.host")
:: localhost

set_nested(config, dotted_path, value)

Sets value at dotted_path inside config, creating intermediate Maps as needed.

config = new_map()
set_nested(config, "db.port", 9999)
get_nested(config, "db.port")
:: 9999

has_nested(config, dotted_path)

config = new_map()
map_set(config, "db", new_map())
map_set(map_get(config, "db"), "host", "localhost")
has_nested(config, "db.host")
:: yes

flatten_config(config, separator)

Flattens every nested key in config into one dotted-key-per-value Map.

config = new_map()
map_set(config, "db", new_map())
map_set(map_get(config, "db"), "host", "localhost")
flatten_config(config, ".")
:: {"db.host": "localhost"}

Get notified when vconfig changes

Get notified about

New versions and security advisories.

New and updated packages, once a day.

News on the math model built in Venutian.