Skip to content
simple Erlang config handler using INI files
Erlang Shell
Find file
New pull request
Latest commit 344a9fb @benoitc bump to 0.7.1
Failed to load latest commit information.
doc bump to 0.7.1
src bump to 0.7.1
test add helpers functions to convert some datatypes
.gitignore build using rebar3
.travis.yml build using rebar3
LICENSE bump to 0.4.2 bump to 0.7.1
NOTICE bump to 0.4.2 bump to 0.7.1
rebar.config remove gproc dependency
rebar.lock remove gproc dependency

econfig - simple Erlang config handler using INI files

Copyright (c) 2012-2015 Benoît Chesneau.

Version: 0.7.1


econfig is a simple Erlang config handler to manage a config from INI files.

Build Status Hex pm

econfig can be use to read and update INI files. Values are cached in an ETS table and you can manage multiple configuration profiles. A process can also subscribe to config updates events.

Autoreload of the config when an INI file is updated is supported, you can even manage changes from a full config directory.

See the NEWS for last changes.

Useful modules are:

  • econfig: main module. It contains all the API.


Quick usage example:

1> application:ensure_all_started(econfig).
2> econfig:register_config(test, ["test/fixtures/test.ini", "test/fixtures/test2.ini"], [autoreload]).
3> econfig:subscribe(test).
4> econfig:get_value(test, "section1").
[{"key 3","value 3"},
 {"key2","value 2"},
 {"key4","value 4"},
5> econfig:set_value(test, "section1", "key6", "value6").
6> flush().
Shell got {config_updated,test,{set,{"section1","key6"}}}

Advanced features

on_change hook

Some application may want to handle changes without suscribing to change. This change allows a user to pass a change function when registering the configuation. This function will be called each time a change happen.

helpers functions

econfig do not guess datatypes of values in configuration files, always storing them internally as strings. This means that if you need other datatypes, you should convert on your own. Some helpers are provided to do it:

  • econfig:get_boolean/{3, 4}: to convert to boolean
  • econfig:get_integer/{3, 4}: to convert to integer
  • econfig:get_float/{3, 4}: to convert to float
  • econfig:get_list/{3, 4}: to convert a list of string separated by , to a list.
  • econfig:get_binary/{3, 4}: to convert to a binary


For issues, comments or feedback please create an issue!

Something went wrong with that request. Please try again.