Configuration file management — unified interface for JSON, YAML and TOML.
Provides operations for loading, validating, writing and merging config files regardless of their format. The format is auto-detected from the file extension and can be explicitly specified.
For .env files and environment variables, use Apero.Env.
Summary
Functions
Detects the config format from a file extension.
Serializes a map to a config string.
Gets a nested value from a config map using dot-separated key path.
Loads a config file. Format is auto-detected from extension.
Merges a list of config maps. Later entries override earlier ones.
Parses a config string in the given format.
Prints a formatted summary of a config map to the terminal.
Sets a nested value in a config map using dot-separated key path.
Validates a config map against a schema map (shallow key-type check).
Writes a map to a config file.
Types
Functions
Detects the config format from a file extension.
Serializes a map to a config string.
Gets a nested value from a config map using dot-separated key path.
Examples
iex> Conf.get(%{retrieval: %{vector_weight: 0.5}}, "retrieval.vector_weight")
0.5
iex> Conf.get(%{foo: 1}, "bar")
nil
Loads a config file. Format is auto-detected from extension.
Merges a list of config maps. Later entries override earlier ones.
Parses a config string in the given format.
Prints a formatted summary of a config map to the terminal.
Sets a nested value in a config map using dot-separated key path.
Returns an updated config map (immutable — original is not modified).
Examples
iex> Conf.set(%{retrieval: %{vector_weight: 0.5}}, "retrieval.vector_weight", 0.8)
%{retrieval: %{vector_weight: 0.8}}
Validates a config map against a schema map (shallow key-type check).
Writes a map to a config file.