{"id":13507657,"url":"https://github.com/phoenixframework/ex_conf","last_synced_at":"2025-10-21T18:57:48.171Z","repository":{"id":14080119,"uuid":"16783803","full_name":"phoenixframework/ex_conf","owner":"phoenixframework","description":"Simple Elixir Configuration Management","archived":true,"fork":false,"pushed_at":"2014-08-05T18:42:31.000Z","size":372,"stargazers_count":35,"open_issues_count":1,"forks_count":6,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-04T06:19:20.844Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phoenixframework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-12T22:11:15.000Z","updated_at":"2024-12-11T22:04:18.000Z","dependencies_parsed_at":"2022-07-11T06:31:50.574Z","dependency_job_id":null,"html_url":"https://github.com/phoenixframework/ex_conf","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phoenixframework%2Fex_conf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phoenixframework%2Fex_conf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phoenixframework%2Fex_conf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phoenixframework%2Fex_conf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phoenixframework","download_url":"https://codeload.github.com/phoenixframework/ex_conf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246301963,"owners_count":20755512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T02:00:37.489Z","updated_at":"2025-10-21T18:57:42.905Z","avatar_url":"https://github.com/phoenixframework.png","language":"Elixir","funding_links":[],"categories":["Configuration"],"sub_categories":[],"readme":"# ExConf\n\u003e Simple Elixir Configuration Management\n\n## Deprecated\nExConf has been replaced by [Mix Configuration](http://elixir-lang.org/docs/stable/mix/Mix.Config.html). See the Phoenix README for new [configuration instructions](https://github.com/phoenixframework/phoenix#configuration).\n\n\n## Features\n- Configuration definitions are *evaluated at runtime*, but merged/defaulted at compile time, allowing runtime dependent lookups. (i.e. `System.get_env`)\n- Configuration modules can extend other configurations for overrides and defaults\n- Evironment based lookup for settings based on provided `env_var`\n\n## Simple Example\n```elixir\n\ndefmodule MyApp.Config do\n  use ExConf.Config\n\n  config :router, ssl: true,\n                  domain: \"example.dev\",\n                  port: System.get_env(\"PORT\")\n\n  config :session, secret: \"secret\"\nend\n\niex\u003e MyApp.Config.router[:domain]\n\"example.dev\"\n\n\ndefmodule MyApp.OtherConfig do\n  use MyApp.Config\n\n  config :session, secret: \"123password\"\nend\n\niex\u003e MyApp.OtherConfig.session[:secret]\n\"123password\"\niex\u003e MyApp.OtherConfig.router[:ssl]\ntrue\n```\n\n\n## Environment Based Configuration\n\nFirst, establish a *base* configuration module that uses `ExConf.Config` and\nprovide an `env_var` option for `System.get_env` lookup at runtime of the current\napplication environment.\n```elixir\ndefmodule MyApp.Config do\n  use ExConf.Config, env_var: \"MIX_ENV\"\n\n  config :router, ssl: true\n  config :twitter, api_token: System.get_env(\"API_TOKEN\")\nend\n```\n\nNext, define \"submodules\" for each environment you need overrides or additional settings for.\nThe *base* config module will look for a \"submodule\" whos name is the value of\n`:env_var` fetched from `System.get_env` in capitalized form.\nThis allows environment specific lookup at runtime via the `env/0` function on the base module.\nIf the environment specific config module does not exist, it falls back to the base module.\n\nHere's what a Dev enviroment config module would look like for `System.get_env(\"MIX_ENV\") == \"dev\"`:\n```elixir\ndefmodule MyApp.Config.Dev do\n  use MyApp.Config\n\n  config :router, ssl: false\n  config :twitter, api_token: \"ABC\"\nend\n\niex\u003e System.get_env(\"MIX_ENV\")\n\"dev\"\n\niex\u003e MyApp.Config.env\nMyApp.Config.Dev\n\niex\u003e MyApp.Config.env.router[:ssl]\nfalse\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphoenixframework%2Fex_conf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphoenixframework%2Fex_conf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphoenixframework%2Fex_conf/lists"}