ex_conf alternatives and similar packages
Based on the "Configuration" category.
Alternatively, view ex_conf alternatives based on common mentions on social networks and blogs.
-
Flasked
DISCONTINUED. Injecting ENV vars into application configuration at runtime (12factor app for Elixir) -
configparser_ex
A simple Elixir parser for the same kind of files that Python's configparser library handles -
mahaul
Supercharge your environment variables in Elixir. Parse and validate with compile time access guarantees, defaults, fallbacks and app pre-boot validations. -
Enux
utility package for loading, validating and documenting your app's configuration variables from env, json, jsonc and toml files at runtime and injecting them into your environment -
CFEnv
Environmental helpers for cloudfoundry, parsing and returning values off VCAP_SERVICES and VCAP_APPLICATON
InfluxDB - Power Real-Time Data Analytics at Scale
Do you think we are missing an alternative of ex_conf or a related project?
Popular Comparisons
README
ExConf
Simple Elixir Configuration Management
Deprecated
ExConf has been replaced by Mix Configuration. See the Phoenix README for new configuration instructions.
Features
- Configuration definitions are evaluated at runtime, but merged/defaulted at compile time, allowing runtime dependent lookups. (i.e.
System.get_env
) - Configuration modules can extend other configurations for overrides and defaults
- Evironment based lookup for settings based on provided
env_var
Simple Example
defmodule MyApp.Config do
use ExConf.Config
config :router, ssl: true,
domain: "example.dev",
port: System.get_env("PORT")
config :session, secret: "secret"
end
iex> MyApp.Config.router[:domain]
"example.dev"
defmodule MyApp.OtherConfig do
use MyApp.Config
config :session, secret: "123password"
end
iex> MyApp.OtherConfig.session[:secret]
"123password"
iex> MyApp.OtherConfig.router[:ssl]
true
Environment Based Configuration
First, establish a base configuration module that uses ExConf.Config
and
provide an env_var
option for System.get_env
lookup at runtime of the current
application environment.
defmodule MyApp.Config do
use ExConf.Config, env_var: "MIX_ENV"
config :router, ssl: true
config :twitter, api_token: System.get_env("API_TOKEN")
end
Next, define "submodules" for each environment you need overrides or additional settings for.
The base config module will look for a "submodule" whos name is the value of
:env_var
fetched from System.get_env
in capitalized form.
This allows environment specific lookup at runtime via the env/0
function on the base module.
If the environment specific config module does not exist, it falls back to the base module.
Here's what a Dev enviroment config module would look like for System.get_env("MIX_ENV") == "dev"
:
defmodule MyApp.Config.Dev do
use MyApp.Config
config :router, ssl: false
config :twitter, api_token: "ABC"
end
iex> System.get_env("MIX_ENV")
"dev"
iex> MyApp.Config.env
MyApp.Config.Dev
iex> MyApp.Config.env.router[:ssl]
false