Skip to content

surik/distillery_consul

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DistilleryConsul

Build Status

Distillery config provider for Consul KV with minium dependencies.

Links:

Installation and Using

The package can be installed by adding distillery_consul to your list of dependencies in mix.exs:

def deps do
  [
    {:distillery_consul, "~> 0.1.0"},
    {:jason, "~> 1.1"}
  ]
end

Then add provider to your release configuration in rel/config.exs:

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:

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]

About

Distillery config provider for Consul KV

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages