Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/reset/libex-config
Helpers for accessing OTP application configuration
https://github.com/reset/libex-config
Last synced: about 2 months ago
JSON representation
Helpers for accessing OTP application configuration
- Host: GitHub
- URL: https://github.com/reset/libex-config
- Owner: reset
- License: other
- Created: 2014-04-30T22:46:13.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-09-02T18:59:11.000Z (over 10 years ago)
- Last Synced: 2024-11-16T13:49:01.331Z (2 months ago)
- Language: Elixir
- Homepage: https://hex.pm/packages/libex_config
- Size: 152 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - Helpers for accessing OTP application configuration. (OTP)
- fucking-awesome-elixir - libex_config - Helpers for accessing OTP application configuration. (OTP)
- awesome-elixir - libex_config - Helpers for accessing OTP application configuration. (OTP)
README
# LibEx.Config
LibEx.Config exposes helpers around accessing OTP application configuration
# Usage
Create a new module and use `LibEx.Config` passing the atom for the name of the application's configuration to wrap:
```elixir
defmodule MyApp.Config do
use LibEx.Config, application: :my_appdefkey :db_host
defkey :db_port
defkey :db_user
defkey :db_pass
end
```Each `defkey` call maps to a setting you define in your mix file:
```elixir
defmodule MyApp.Mixfile do
def application do
[
env: [
env: :dev,
db_host: "localhost",
db_port: 5432,
db_user: "postgres",
db_pass: "postgres",
db_name: "my_app"
]
]
end
end
```Now you can get the configured variables
```elixir
MyApp.Config.db_host
```Or set them
```elixir
MyAppConfig.db_host("other_database_name")
```# Authors
Jamie Winsor ()