Elixir v1.9.4 Config.Reader View Source
API for reading config files defined with
Config.Reader can also be used as a
When used as a provider, it expects a single argument:
which the configuration path (as outlined in
Config.Provider.config_path/0) for the configuration
to be read and loaded during the system boot.
Link to this section Summary
Link to this section Functions
merge(config1, config2)View Source (since 1.9.0)
Merges two configurations.
The configurations are merged together with the values in the second one having higher preference than the first in case of conflicts. In case both values are set to keyword lists, it deep merges them.
iex> Config.Reader.merge([app: [k: :v1]], [app: [k: :v2]]) [app: [k: :v2]] iex> Config.Reader.merge([app: [k: [v1: 1, v2: 2]]], [app: [k: [v2: :a, v3: :b]]]) [app: [k: [v1: 1, v2: :a, v3: :b]]] iex> Config.Reader.merge([app1: ], [app2: ]) [app1: , app2: ]
read!(file, imported_paths \\ )View Source (since 1.9.0)
Reads the configuration file.
The same as
read_imports!/2 but only returns the configuration
in the given file, without returning the imported paths.
It exists for convenience purposes. For example, you could
invoke it inside your
mix.exs to read some external data
you decided to move to a configuration file:
read_imports!(file, imported_paths \\ )View Source (since 1.9.0)
Reads the given configuration file alongside its imports.
It accepts a list of
imported_paths that should raise if attempted
to be imported again (to avoid recursive imports).
It returns a tuple with the configuration and the imported paths.