conf() = atom() | string() | binary()
config_options() = [autoreload | {autoreload, integer} | {change_fun, function()}]
inifile() = string()
inifiles() = [inifile()]
key() = string()
section() = string()
value() = string()
all/1 | get all values of a configuration. |
cfg2list/1 | retrive config as a proplist. |
cfg2list/2 | retrieve config as a proplist. |
delete_value/2 | delete all key/values from a section. |
delete_value/3 | delete a value and persist the change to the file. |
delete_value/4 | delete a value and optionnally persist it. |
get_binary/3 | get a value and convert it to an float. |
get_binary/4 | get a value and convert it to an float. |
get_boolean/3 | get a value and convert it to a boolean if possible This method is case-insensitive and recognizes Boolean values from 'yes'/'no', 'on'/'off', 'true'/'false' and '1'/'0' a badarg error is raised if the value can't be parsed to a boolean. |
get_boolean/4 | get a value and convert it to a boolean if possible. |
get_float/3 | get a value and convert it to an float. |
get_float/4 | get a value and convert it to an float. |
get_integer/3 | get a value and convert it to an integer. |
get_integer/4 | get a value and convert it to an integer. |
get_list/3 | get a value and convert it to an float. |
get_list/4 | get a value and convert it to an float. |
get_value/2 | get keys/values of a section. |
get_value/3 | get value for a key in a section. |
get_value/4 | |
open_config/2 | open or create an ini file an register it. |
open_config/3 | open or create an ini file an register it. |
prefix/2 | get all sections starting by Prefix. |
register_config/2 | register inifiles or config dirs. |
register_config/3 | register inifiles of config dirs with options
For now the only option is autoreload to auto reload the config on
files or dirs changes. |
reload/1 | reload the configuration. |
reload/2 | reload the configuration. |
sections/1 | get all sections of a configuration. |
set_value/3 | set a list of key/value for a section. |
set_value/4 | set a value and persist it to the file. |
set_value/5 | set a value and optionnaly persist it. |
start_autoreload/1 | start the config watcher. |
stop_autoreload/1 | stop the config watcher. |
subscribe/1 | Subscribe to config events for a config named ConfigName |
unregister_config/1 | unregister a conf. |
unsubscribe/1 | Remove subscribtion created using subscribe(ConfigName) . |
get all values of a configuration
retrive config as a proplist
retrieve config as a proplist
delete all key/values from a section
delete a value and persist the change to the file
delete a value and optionnally persist it
get a value and convert it to an float
get_binary(ConfigName::conf(), Section::section(), Key::key(), Default::binary()) -> Value::binary()
get a value and convert it to an float
get a value and convert it to a boolean if possible This method is case-insensitive and recognizes Boolean values from 'yes'/'no', 'on'/'off', 'true'/'false' and '1'/'0' a badarg error is raised if the value can't be parsed to a boolean
get_boolean(ConfigName::conf(), Section::section(), Key::key(), Default::boolean()) -> Value::boolean()
get a value and convert it to a boolean if possible. It fallback to default if not set. This method is case-insensitive and recognizes Boolean values from 'yes'/'no', 'on'/'off', 'true'/'false' and '1'/'0' a badarg error is raised if the value can't be parsed to a boolean
get a value and convert it to an float
get a value and convert it to an float
get a value and convert it to an integer
get_integer(ConfigName::conf(), Section::section(), Key::key(), Default::integer()) -> Value::integer()
get a value and convert it to an integer
get a value and convert it to an float
get a value and convert it to an float
get keys/values of a section
get value for a key in a section
open_config(ConfigName::conf(), IniFiles::inifiles()) -> ok | {error, any()}
open or create an ini file an register it
open_config(ConfigName::conf(), IniFiles::inifiles(), Options::config_options()) -> ok | {error, any()}
open or create an ini file an register it. See the register_config function for a list of available functions.
get all sections starting by Prefix
register_config(ConfigName::conf(), IniFiles::inifiles()) -> ok | {error, any()}
register inifiles or config dirs
register_config(ConfigName::conf(), IniFiles::inifiles(), Options::config_options()) -> ok | {error, any()}
register inifiles of config dirs with options
For now the only option is autoreload
to auto reload the config on
files or dirs changes.
Configs can also be registererd in the app configuration at startup:
[confs, [{ConfigName, IniFile}, {ConfigName1, IniFiles1, [Options]}, ..]]
Options:
-autoreload
: auto reload the config on files or dirs changes
- {autoreload, Delay}
: autoreload the config file or dir
changes. Delay set the time between each scan. Default is 5000
and can be set using the scan_delay
application environement
for econfig.
reload(ConfigName::conf()) -> ok
reload the configuration
reload(ConfigName::conf(), IniFiles::inifiles()) -> ok
reload the configuration
get all sections of a configuration
set a list of key/value for a section
set a value and persist it to the file
set_value(ConfigName::conf(), Section::section(), Key::key(), Value::value(), Persist::boolean()) -> ok
set a value and optionnaly persist it.
start_autoreload(ConfigName::conf()) -> ok
start the config watcher.
stop_autoreload(ConfigName::conf()) -> ok
stop the config watcher.
subscribe(ConfigName::conf()) -> ok
Subscribe to config events for a config named ConfigName
The message received to each subscriber will be of the form:
{config_updated, ConfigName, {Section, Key}}
unregister_config(ConfigName::conf()) -> ok
unregister a conf
unsubscribe(ConfigName::conf()) -> ok
Remove subscribtion created using subscribe(ConfigName)
Generated by EDoc, Nov 7 2015, 11:59:34.