Module openflax.conf

OpenFlax configuration datatype module.

Description

OpenFlax configuration datatype module.

This module defines an abstract data type conf() which represents a set of configuration settings.

conf()s are immutable. You must create a new conf() from an existing one; you cannot change it.

Function Index

delete_value/2Deletes a value from a conf().
dump/1Retrieves all values from a conf() as a list of key-value pairs.
fold/3Creates a new term by applying a fun/3 (Key, Value, Acc) to each key-value pair in the conf().
get_string/2Retrieves a string from a conf().
get_value/2Retrieves a value from a conf().
load/1The configuration settings are loaded from the named config modules.
map/2Creates a new conf() by applying a fun/2 (Key, Value) to each key-value pair in the conf().
merge/2Creates a new conf() by merging two conf()s.
merge/3Creates a new conf() by merging two conf()s and applying a fun/3 (Key, ValueA, ValueB) when there are colliding keys.
new/0Creates a new conf().
new/1Creates a new conf() from a list of key-value pairs.
put_value/3Updates a value in a conf().

Function Details

delete_value/2

delete_value(Key::key(), Conf::conf()) -> conf()

Deletes a value from a conf(). Returns a new conf().

dump/1

dump(Conf::conf()) -> [{key(), value()}]

Retrieves all values from a conf() as a list of key-value pairs.

fold/3

fold(Fun::fun(), Acc::term(), Conf::conf()) -> term()

Creates a new term by applying a fun/3 (Key, Value, Acc) to each key-value pair in the conf(). The return value of the fun is a new accumulator.

get_string/2

get_string(Key::key(), Conf::conf()) -> string()

Retrieves a string from a conf(). The returned value is always converted to a flattened string.

get_value/2

get_value(Key::key(), Conf::conf()) -> {ok, term()} | error

Retrieves a value from a conf().

load/1

load(ConfigModuleNames::[modulename()]) -> dict()

The configuration settings are loaded from the named config modules. They are returned in a 'master dictionary' where the keys are atoms (section names) and the values are conf()s.

map/2

map(Fun::fun(), Conf::conf()) -> conf()

Creates a new conf() by applying a fun/2 (Key, Value) to each key-value pair in the conf(). The return value of the fun is a new value to use for the key in the new conf().

merge/2

merge(A::conf(), B::conf()) -> conf()

Creates a new conf() by merging two conf()s. Mostly equivalent to merge(fun(K, V1, V2) -> V2 end, A, B), except that cumulative settings are not wholly overridden, but rather, accumulated.

merge/3

merge(Fun::fun(), A::conf(), B::conf()) -> conf()

Creates a new conf() by merging two conf()s and applying a fun/3 (Key, ValueA, ValueB) when there are colliding keys. The return value of the fun is the value which will be used in the new conf().

new/0

new() -> conf()

Creates a new conf().

new/1

new(List::[{key(), value()}]) -> conf()

Creates a new conf() from a list of key-value pairs.

put_value/3

put_value(Key::key(), Value::value(), Conf::conf()) -> conf()

Updates a value in a conf(). Returns a new conf() with the specified key representing a new value.