Use TOML rather than JSON for the vyconfd.conf config
Closed, ResolvedPublic

Description

Right now in the prorotype, the config file where vyconf gets its settings, such as log file, is in JSON. Not the best option for configs, and autogenerated deserializer is absolutely not the best option either because configs have optional fields.
Something more ini-like would be easier to use for people.

There's TOML, an ini-like language that allows a lot more than normal INI files can do, though we'll not be using more than sections and simple key-value pairs. It's still nice to know that if we need to, we can.
Incidentally, there's also a nice OCaml module for it, with lenses and stuff.

The config format is as follows:

# This section is mandatory
[appliance]

# Appliance name for system messages
name = "VyOS"

# This is where interface definitions and other data is stored
data_dir = "/usr/share/vyos"

# This is where scripts that generate application configs and do other things are stored
program_dir = "/usr/libexec/vyos"

# This is where appliance configs are stored
config_dir = "/etc/vyos"

# This is the config that is loaded at boot time, path is relative to the the config_dir
primary_config = "config.boot"

# This is the config that is loaded is primary config failed to load, path is relative to the config_dir
fallback_config = "config.failsafe"

# This section is optional
[vyconf]

# Self-descriptive, I guess
socket = "/var/run/vyconfd.sock"
pid_file = "/var/run/vyconfd.pid"
log_file = "/var/log/vyconfd.log"

Details

Difficulty level
Normal (likely a few hours)
dmbaturin created this object with edit policy "Subscribers".
dmbaturin closed this task as Resolved.Dec 14 2016, 11:02 AM

Looks like it works, and the tests pass.