veko doc
Self-Contained API Reference • Gradual Types • Capabilities • Wasm Sandbox

codec/ini

lib/codec/ini.vk

lib/codec/ini.vk Pure-Veko .ini / .conf section-key-value configuration parser and serializer. Zero capabilities required.

signature
parse = fn [input str] map[map[str]]

Parses INI text into a two-level map { section_name = { key = value } }. Top-level keys outside any [section] are placed under the '' (root) section. Lines starting with # or ; are treated as comments.

Executable Example
veko
use [ini = codec/ini]
cfg = ini/parse '[server]\nhost = 127.0.0.1\nport = 8443\n# comment\n[tls]\nmin = 1.3'
if (ini/get cfg 'server' 'port') != '8443' or (ini/get cfg 'tls' 'min') != '1.3' [
  err 'ini/parse'
] else [ .ok ]
get fn
signature
get = fn [cfg map[map[str]], section str, key str] str

Looks up key inside section of parsed INI cfg, returning err if missing (combine with /or).

signature
encode = fn [cfg map[map[str]]] str

Serializes a two-level INI section map back into .ini text.