https://github.com/trax-retail/json_confix
Crowd library: Load configuration from JSON files for Elixir apps
https://github.com/trax-retail/json_confix
crowd elixir
Last synced: 4 months ago
JSON representation
Crowd library: Load configuration from JSON files for Elixir apps
- Host: GitHub
- URL: https://github.com/trax-retail/json_confix
- Owner: trax-retail
- Created: 2019-04-01T09:03:07.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-11-12T09:14:30.000Z (over 6 years ago)
- Last Synced: 2026-01-14T07:33:54.815Z (5 months ago)
- Topics: crowd, elixir
- Language: Elixir
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 36
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# JsonConfix
JsonConfix provides a [Distillery](https://github.com/bitwalker/distillery) release config provider that replaces config tuples (e.g {:json, value}) with values read from a JSON file.
Most of the code has been taken from [ConfigTuples](https://github.com/rockneurotiko/config_tuples)
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `json_confix` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:json_confix, "~> 0.2.0"}
]
end
```
## Usage
If your JSON file with the configuration is like this
```
// /path/to/my/secrets.json
{
"noise": {
...
},
"secrets": {
"data": {
"MY_SECRET": "***************",
"ANOTHER_SECRET": "**************"
}
},
"more_noise": {
...
}
}
```
Your configuration should look like:
```elixir
config :json_confix,
file_path: "/path/to/my/secrets.json" # Defaults to /tmp/json_confix.json,
json_keys: ["secrets", "data"]
```
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at [https://hexdocs.pm/json_confix](https://hexdocs.pm/json_confix).