Sovite.Core.Config.Settings (sovite v0.6.0)

Copy Markdown View Source

The settings of a config file as key = value lines, like Postfix's postconf: every key of the schema, with its value from the file or its default. Keys are dotted paths (smtp.max_message_size), with array indexes for tables that repeat (listener[0].port). Values are TOML.

smtp.max_message_size = "25M"
listener[0].mode = "submission"

Keys that have neither a value nor a default are left out, and so are listener keys whose default depends on the listener's mode. Secrets (passwords, client secrets, SRS secrets, the password in database.url, tracing.headers values) are shown as "********".

Summary

Types

A setting: its key, its value as TOML, and whether the value is the default.

Functions

The settings that differ between old and new, as {key, old_value, new_value}; a value is nil when the key has none on that side.

Formats settings as lines.

The settings of a decoded config file (Sovite.Core.Config raw).

Types

setting()

@type setting() :: {key :: String.t(), value :: String.t(), default? :: boolean()}

A setting: its key, its value as TOML, and whether the value is the default.

Functions

diff(old, new)

@spec diff([setting()], [setting()]) :: [
  {String.t(), String.t() | nil, String.t() | nil}
]

The settings that differ between old and new, as {key, old_value, new_value}; a value is nil when the key has none on that side.

format(settings)

@spec format([setting()]) :: String.t()

Formats settings as lines.

list(raw)

@spec list(map()) :: [setting()]

The settings of a decoded config file (Sovite.Core.Config raw).