View Source dotenv_config (dotenv_config v1.2.0)

Summary

Functions

get/1 Get configuration item from the persistent term storage.
get_all/0 Get all configuration items from the persistent term storage.
init/2 Load configuration from environment variables and override it by provided .env files (if duplicate last provided file wins) and store it in the persistent term storage. Parameters: Module - module which will be used to parse the configuration (see readme for details) FileNames - list of names of the files to load configuration from Returns: ok - if configuration was successfully loaded and stored {error, Reason} - if there was an error during loading or storing
set/2 Set configuration item in the persistent term storage.

Types

-type config_item_name() :: binary().
Link to this type

config_item_raw_value/0

View Source
-type config_item_raw_value() :: binary().
-type config_item_type() ::
    simple_config_type() | [exact_value() | simple_config_type()] | convert_function().
-type config_item_value() :: any().
-type convert_function() :: fun((config_item_raw_value()) -> config_item_value()).
-type exact_value() :: {exact, binary()}.
-type parsed_config() :: [{config_item_name(), config_item_value()}].
-type parser() :: [{config_item_name(), config_item_type()}].
-type simple_config_type() :: str | int | bool | json | atom | module | charlist.

Functions

-spec get(config_item_name()) -> {ok, config_item_value()} | {error, not_found}.
get/1 Get configuration item from the persistent term storage.
-spec get_all() -> parsed_config().
get_all/0 Get all configuration items from the persistent term storage.
-spec init(module(), [file:name_all()]) -> ok.
init/2 Load configuration from environment variables and override it by provided .env files (if duplicate last provided file wins) and store it in the persistent term storage. Parameters: Module - module which will be used to parse the configuration (see readme for details) FileNames - list of names of the files to load configuration from Returns: ok - if configuration was successfully loaded and stored {error, Reason} - if there was an error during loading or storing
Link to this function

set(ConfigItemName, ConfigItemValue)

View Source
-spec set(config_item_name(), config_item_value()) -> ok.
set/2 Set configuration item in the persistent term storage.