https://github.com/surik/distillery_consul
Distillery config provider for Consul KV
https://github.com/surik/distillery_consul
consul distillery elixir
Last synced: 3 months ago
JSON representation
Distillery config provider for Consul KV
- Host: GitHub
- URL: https://github.com/surik/distillery_consul
- Owner: surik
- Created: 2018-10-03T12:25:06.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-17T17:09:35.000Z (over 6 years ago)
- Last Synced: 2025-02-28T06:32:08.911Z (3 months ago)
- Topics: consul, distillery, elixir
- Language: Elixir
- Homepage:
- Size: 14.6 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DistilleryConsul
[](https://travis-ci.org/surik/distillery_consul)
Distillery config provider for Consul KV with minium dependencies.
Links:
* [Custom Configuration Providers](https://hexdocs.pm/distillery/extensibility/config_providers.html)
* [Consul Key/Value Store](https://www.consul.io/intro/getting-started/kv.html)## Installation and Using
The package can be installed by adding `distillery_consul` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:distillery_consul, "~> 0.1.0"},
{:jason, "~> 1.1"}
]
end
```Then add provider to your release configuration in `rel/config.exs`:
```elixir
release :app do
set version: current_version(:app)
set applications: [
:runtime_tools
]
set config_providers: [
{DistilleryConsul.Provider, [
host: "http://localhost",
port: 8500,
token: "ConsulAccessToken12345" # may be absent
]}
]
```Now you can use `{:consul, "some/key"}` as value in your Elixir configuration file.
The following configuration:
```elixir
config :app,
rate_limit: {:consul, :integer, "app/rate_limit"},
url: {:consul, :string, "app/url"},
level: {:consul, :atom, "app/level"}
```They will be changed based on values in Consul KV during release startup:
```
$ _build/dev/rel/app/bin/app console
...
iex([email protected])1> Application.get_all_env(:app)
[rate_limit: 100, url: "https:/example.com:8081/service", level: :info]
```