Exconf v0.1.0 Exconfig View Source

The module Exconfig provides the API for the Exconfig-package.

This is

  • get/0 ... get all cached settings
  • get/3 ... get a specific entry (read if not cached)
  • and clear_cache!/0 ... remove all entries from the cache

Link to this section Summary

Functions

Remove all entries from the cache, so they will be re-read if accessed again.

Get the entire loaded cache.

Get a value from cache or load it if not cached yet.

Link to this section Functions

Remove all entries from the cache, so they will be re-read if accessed again.

Get the entire loaded cache.

Examples

iex> Exconfig.get()
%{}
Link to this function

get(application_key, key, default \\ nil) View Source

Get a value from cache or load it if not cached yet.

Examples

Return the default if key is not found anywhere

iex> Exconfig.get(:exconfig, :unknown_config_key, :not_found)
:not_found

Return from a value configured in config/*

iex> Exconfig.get(:logger, :level, :error)
:debug

Return a value provided as a system environment var

The given key will be converted to a string, if it is an :atom. Also, it will be uppercased.

iex> System.put_env("ELIXIRRULEZ", "true")
iex> Exconfig.get(:exconfig, :elixirrulez, :not_found)
"true"