Packages

A simple somewhat opinionated consul config provider for elixir 1.9+ releases.

Current section

8 Versions

Jump to

Compare versions

23 files changed
+622 additions
-355 deletions
  @@ -11,8 +11,8 @@ The package can be installed by adding `consul_config_provider` to your list of
11 11 ```elixir
12 12 def deps do
13 13 [
14 - {:consul_config_provider, "~> 0.1.0"},
15 - {:mojito, "~> 0.6.0"},
14 + {:consul_config_provider, "~> 0.1.4"},
15 + {:mojito, "~> 0.6.3"}, # default implmentation for http client
16 16 ]
17 17 end
18 18 ```
  @@ -39,6 +39,42 @@ releases: [
39 39 ],
40 40 ```
41 41
42 + ### Transformer
43 + - You can also implement an optional transformer behaviour to change the form of your configs.
44 + - This is helpful for interopt with erlang modules that might have different opinions about things
45 +
46 + ```elixir
47 + defmodule Example.Config do
48 + @behaviour ConsulConfigProvider.Transformer
49 +
50 + @impl true
51 + def transform({:erlkaf, [clients: [producer: [client_options: client_options]]]}) do
52 + default_client_options =
53 + Application.get_env(:erlkaf, :clients, [])
54 + |> Keyword.get(:producer, [])
55 + |> Keyword.get(:client_options, [])
56 +
57 + {:erlkaf,
58 + [
59 + clients: [
60 + producer: [
61 + type: :producer,
62 + client_options: Keyword.merge(default_client_options, client_options)
63 + ]
64 + ]
65 + ]}
66 + end
67 +
68 + @impl true
69 + def transform(config), do: config
70 + end
71 + ```
72 +
73 + Then in your configs:
74 + ```elixir
75 + config :consul_config_provider, transformer_module: Example.Config
76 + ```
77 +
42 78 ### Information
43 79 * This provider assumes the config name has a file extension which is either `.json`, `.yml`, or `.yaml` no other extensions are supported although PRs would be welcomed. If you do not follow this naming convention the provider will not work and throw.
44 80 * In the above the `prefix` is used for the keys path and can also be set with `CONSUL_PREFIX` (provide an empty string to the prefix if you wish to just use the env var)
  @@ -1,16 +1,17 @@
1 - dist/search_items-462ce5577f.js
1 + dist/search_items-bd9294992b.js
2 2 dist/html-9914b37a220eb2c313b6.css
3 3 dist/html-9914b37a220eb2c313b6.js
4 4 dist/html/fonts/icomoon.eot
5 5 dist/html/fonts/icomoon.svg
6 6 dist/html/fonts/icomoon.ttf
7 7 dist/html/fonts/icomoon.woff
8 - dist/sidebar_items-0117df032b.js
8 + dist/sidebar_items-eaca442f7e.js
9 9 api-reference.html
10 10 readme.html
11 11 search.html
12 12 404.html
13 - Client.Mojito.html
14 13 ConsulConfigProvider.html
15 - Http.html
14 + ConsulConfigProvider.Client.Mojito.html
15 + ConsulConfigProvider.Http.html
16 + ConsulConfigProvider.Transformer.html
16 17 index.html
  @@ -5,11 +5,11 @@
5 5 <meta http-equiv="x-ua-compatible" content="ie=edge">
6 6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 7 <meta name="generator" content="ExDoc v0.21.1">
8 - <meta name="project" content="Consul Config Provider v0.1.2">
9 - <title>404 — Consul Config Provider v0.1.2</title>
8 + <meta name="project" content="Consul Config Provider v0.1.4">
9 + <title>404 — Consul Config Provider v0.1.4</title>
10 10 <link rel="stylesheet" href="dist/html-9914b37a220eb2c313b6.css" />
11 11 <link rel="canonical" href="https://hexdocs.pm/consul_config_provider/404.html" />
12 - <script src="dist/sidebar_items-0117df032b.js"></script>
12 + <script src="dist/sidebar_items-eaca442f7e.js"></script>
13 13 <script src="docs_config.js"></script>
14 14 <script async src="dist/html-9914b37a220eb2c313b6.js"></script>
15 15 </head>
  @@ -44,7 +44,7 @@
44 44 <a href="https://github.com/blueshift-labs/consul_config_provider" class="sidebar-projectName">
45 45 Consul Config Provider </a>
46 46 <h2 class="sidebar-projectVersion">
47 - v0.1.2
47 + v0.1.4
48 48 </h2>
49 49 </div>
50 50 </div>
  @@ -1,113 +0,0 @@
1 - <!DOCTYPE html>
2 - <html lang="en">
3 - <head>
4 - <meta charset="utf-8">
5 - <meta http-equiv="x-ua-compatible" content="ie=edge">
6 - <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 - <meta name="generator" content="ExDoc v0.21.1">
8 - <meta name="project" content="Consul Config Provider v0.1.2">
9 - <title>Client.Mojito — Consul Config Provider v0.1.2</title>
10 - <link rel="stylesheet" href="dist/html-9914b37a220eb2c313b6.css" />
11 - <link rel="canonical" href="https://hexdocs.pm/consul_config_provider/Client.Mojito.html" />
12 - <script src="dist/sidebar_items-0117df032b.js"></script>
13 - <script src="docs_config.js"></script>
14 - <script async src="dist/html-9914b37a220eb2c313b6.js"></script>
15 - </head>
16 - <body data-type="modules">
17 - <script>try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }</script>
18 - <div class="main">
19 -
20 - <button class="sidebar-button sidebar-toggle">
21 - <span class="icon-menu" title="Collapse/expand sidebar"></span>
22 - </button>
23 -
24 - <section class="sidebar">
25 - <form class="sidebar-search" action="search.html">
26 - <button type="submit" class="search-button">
27 - <span class="icon-search" aria-hidden="true"></span>
28 - </button>
29 - <button type="button" tabindex="-1" class="search-close-button">
30 - <span class="icon-cross" title="Cancel search"></span>
31 - </button>
32 - <label class="search-label">
33 - <input name="q" type="text" id="search-list" class="search-input" placeholder="Search..." aria-label="Search" autocomplete="off" />
34 - </label>
35 - </form>
36 -
37 - <div class="autocomplete">
38 - <div class="autocomplete-results">
39 - </div>
40 - </div>
41 -
42 - <div class="sidebar-header">
43 - <div class="sidebar-projectDetails">
44 - <a href="https://github.com/blueshift-labs/consul_config_provider" class="sidebar-projectName">
45 - Consul Config Provider </a>
46 - <h2 class="sidebar-projectVersion">
47 - v0.1.2
48 - </h2>
49 - </div>
50 - </div>
51 -
52 - <ul class="sidebar-listNav">
53 - <li><a id="extras-list" href="#full-list">Pages</a></li>
54 -
55 - <li><a id="modules-list" href="#full-list">Modules</a></li>
56 -
57 -
58 - </ul>
59 - <div class="gradient"></div>
60 - <ul id="full-list" class="sidebar-fullList"></ul>
61 - </section>
62 -
63 - <section class="content">
64 - <div class="content-outer">
65 - <div id="content" class="content-inner">
66 -
67 - <h1>
68 - <small class="app-vsn">Consul Config Provider v0.1.2</small>
69 - Client.Mojito <a href="https://github.com/blueshift-labs/consul_config_provider/blob/master/lib/client/mojito.ex#L1" title="View Source" class="view-source" rel="help">
70 - <span class="icon-code" aria-hidden="true"></span>
71 - <span class="sr-only">View Source</span>
72 - </a>
73 - </h1>
74 -
75 -
76 - <section id="moduledoc">
77 - <p>Http client using mojito</p>
78 - </section>
79 -
80 -
81 - <footer class="footer">
82 - <p>
83 - <span class="line">
84 - Built using
85 - <a href="https://github.com/elixir-lang/ex_doc" title="ExDoc" target="_blank" rel="help noopener">ExDoc</a> (v0.21.1),
86 - </span>
87 - <span class="line">
88 - designed by
89 - <a href="https://twitter.com/dignifiedquire" target="_blank" rel="noopener" title="@dignifiedquire">Friedel Ziegelmayer</a>.
90 - </span>
91 - </p>
92 - <p>
93 - <button class="line footer-button night-mode-toggle">
94 - Toggle night mode
95 - </button>
96 - <button class="line footer-button tooltips-toggle">
97 - <span class="tooltips-option-disable">Disable tooltips</span>
98 - <span class="tooltips-option-enable">Enable tooltips</span>
99 - </button>
100 - <button class="line footer-button display-shortcuts-help">
101 - Display keyboard shortcuts
102 - </button>
103 - <button class="line footer-button display-quick-switch">
104 - Go to a HexDocs package
105 - </button>
106 - </p>
107 - </footer>
108 - </div>
109 - </div>
110 - </section>
111 - </div>
112 - </body>
113 - </html>
  @@ -0,0 +1,113 @@
1 + <!DOCTYPE html>
2 + <html lang="en">
3 + <head>
4 + <meta charset="utf-8">
5 + <meta http-equiv="x-ua-compatible" content="ie=edge">
6 + <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 + <meta name="generator" content="ExDoc v0.21.1">
8 + <meta name="project" content="Consul Config Provider v0.1.4">
9 + <title>ConsulConfigProvider.Client.Mojito — Consul Config Provider v0.1.4</title>
10 + <link rel="stylesheet" href="dist/html-9914b37a220eb2c313b6.css" />
11 + <link rel="canonical" href="https://hexdocs.pm/consul_config_provider/ConsulConfigProvider.Client.Mojito.html" />
12 + <script src="dist/sidebar_items-eaca442f7e.js"></script>
13 + <script src="docs_config.js"></script>
14 + <script async src="dist/html-9914b37a220eb2c313b6.js"></script>
15 + </head>
16 + <body data-type="modules">
17 + <script>try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }</script>
18 + <div class="main">
19 +
20 + <button class="sidebar-button sidebar-toggle">
21 + <span class="icon-menu" title="Collapse/expand sidebar"></span>
22 + </button>
23 +
24 + <section class="sidebar">
25 + <form class="sidebar-search" action="search.html">
26 + <button type="submit" class="search-button">
27 + <span class="icon-search" aria-hidden="true"></span>
28 + </button>
29 + <button type="button" tabindex="-1" class="search-close-button">
30 + <span class="icon-cross" title="Cancel search"></span>
31 + </button>
32 + <label class="search-label">
33 + <input name="q" type="text" id="search-list" class="search-input" placeholder="Search..." aria-label="Search" autocomplete="off" />
34 + </label>
35 + </form>
36 +
37 + <div class="autocomplete">
38 + <div class="autocomplete-results">
39 + </div>
40 + </div>
41 +
42 + <div class="sidebar-header">
43 + <div class="sidebar-projectDetails">
44 + <a href="https://github.com/blueshift-labs/consul_config_provider" class="sidebar-projectName">
45 + Consul Config Provider </a>
46 + <h2 class="sidebar-projectVersion">
47 + v0.1.4
48 + </h2>
49 + </div>
50 + </div>
51 +
52 + <ul class="sidebar-listNav">
53 + <li><a id="extras-list" href="#full-list">Pages</a></li>
54 +
55 + <li><a id="modules-list" href="#full-list">Modules</a></li>
56 +
57 +
58 + </ul>
59 + <div class="gradient"></div>
60 + <ul id="full-list" class="sidebar-fullList"></ul>
61 + </section>
62 +
63 + <section class="content">
64 + <div class="content-outer">
65 + <div id="content" class="content-inner">
66 +
67 + <h1>
68 + <small class="app-vsn">Consul Config Provider v0.1.4</small>
69 + ConsulConfigProvider.Client.Mojito <a href="https://github.com/blueshift-labs/consul_config_provider/blob/master/lib/client/mojito.ex#L1" title="View Source" class="view-source" rel="help">
70 + <span class="icon-code" aria-hidden="true"></span>
71 + <span class="sr-only">View Source</span>
72 + </a>
73 + </h1>
74 +
75 +
76 + <section id="moduledoc">
77 + <p>Http client using mojito</p>
78 + </section>
79 +
80 +
81 + <footer class="footer">
82 + <p>
83 + <span class="line">
84 + Built using
85 + <a href="https://github.com/elixir-lang/ex_doc" title="ExDoc" target="_blank" rel="help noopener">ExDoc</a> (v0.21.1),
86 + </span>
87 + <span class="line">
88 + designed by
89 + <a href="https://twitter.com/dignifiedquire" target="_blank" rel="noopener" title="@dignifiedquire">Friedel Ziegelmayer</a>.
90 + </span>
91 + </p>
92 + <p>
93 + <button class="line footer-button night-mode-toggle">
94 + Toggle night mode
95 + </button>
96 + <button class="line footer-button tooltips-toggle">
97 + <span class="tooltips-option-disable">Disable tooltips</span>
98 + <span class="tooltips-option-enable">Enable tooltips</span>
99 + </button>
100 + <button class="line footer-button display-shortcuts-help">
101 + Display keyboard shortcuts
102 + </button>
103 + <button class="line footer-button display-quick-switch">
104 + Go to a HexDocs package
105 + </button>
106 + </p>
107 + </footer>
108 + </div>
109 + </div>
110 + </section>
111 + </div>
112 + </body>
113 + </html>
Loading more files…