Packages

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

Current section

8 Versions

Jump to

Compare versions

38 files changed
+939 additions
-1054 deletions
  @@ -12,17 +12,19 @@ The package can be installed by adding `consul_config_provider` to your list of
12 12 def deps do
13 13 [
14 14 {:consul_config_provider, "~> 0.2"},
15 - {:mojito, "~> 0.7"}, # default implmentation for http client
15 + {:finch, "~> 0.12"}, # default implementation for http client
16 16 ]
17 17 end
18 18 ```
19 - * Only add in mojito if you want to use the default http behaviour and not define your own client
19 +
20 + - Only add in finch if you want to use the default http behaviour and not define your own client
20 21
21 22 The docs can be found at [https://hexdocs.pm/consul_config_provider](https://hexdocs.pm/consul_config_provider).
22 23
23 - ### Sample Usage
24 + ## Sample Usage
25 +
26 + - In `mix.exs`
24 27
25 - * In mix.exs
26 28 ```elixir
27 29 releases: [
28 30 release_name: [
  @@ -40,8 +42,9 @@ releases: [
40 42 ```
41 43
42 44 ### 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 + - You can also implement an optional transformer behaviour to change the form of your configs
47 + - This is helpful for interop with erlang modules that might have different opinions about things
45 48
46 49 ```elixir
47 50 defmodule Example.Config do
  @@ -71,14 +74,23 @@ end
71 74 ```
72 75
73 76 Then in your configs:
77 +
74 78 ```elixir
75 79 config :consul_config_provider, transformer_module: Example.Config
76 80 ```
77 81
78 - ### Information
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.
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)
81 - * The `CONSUL_HOST` env var is used for the host to talk to consul and defaults to localhost
82 - * The `CONSUL_PORT` env var is used for the port to talk to consul and defaults to 8500
83 - * The http_module is dynamic and you can specify your own if you choose to do so. Just implement the HTTP behaviour and make your implementation return an `{:ok, json_body_binary_string}` as per the mojito example which will be the fallback. You might have to deal with coercing the input keyword list for the mojito arguments to support the client you are using, as well. You also need to set `config :consul_config_provider, :http_module, Client.YourClient` pointing to your client in your configs.
84 - * Dependency-related configs are namespaced with their own application name while other configs use the input app_name for their namespace
82 + ## Information
83 +
84 + - 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.
85 + - 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)
86 + - The `CONSUL_HOST` env var is used for the host to talk to consul and defaults to localhost
87 + - The `CONSUL_PORT` env var is used for the port to talk to consul and defaults to 8500
88 + - The http_module is dynamic and you can specify your own if you choose to do so. Just implement the HTTP behaviour and make your implementation return an `{:ok, json_body_binary_string}` as per the finch example which will be the fallback. You might have to deal with coercing the input keyword list for the finch arguments to support the client you are using, as well. You also need to set `config :consul_config_provider, :http_module, Client.YourClient` pointing to your client in your configs.
89 + - Dependency-related configs are namespaced with their own application name while other configs use the input app_name for their namespace
90 +
91 + ## Release
92 +
93 + - Increment [mix.exs project version](https://github.com/blueshift-labs/consul_config_provider/blob/master/mix.exs#L7)
94 + - Update CHANGELOG.md
95 + - Create a release in the [github ui](https://github.com/blueshift-labs/consul_config_provider/releases/new)
96 + - Github actions will create a hex release and upload it
  @@ -1,17 +1,19 @@
1 1 404.html
2 - ConsulConfigProvider.Client.Mojito.html
2 + ConsulConfigProvider.Client.Finch.html
3 3 ConsulConfigProvider.Http.html
4 4 ConsulConfigProvider.Transformer.html
5 5 ConsulConfigProvider.html
6 6 api-reference.html
7 - dist/app-f27ff079945e43879c46.js
8 - dist/elixir-a172fe91e725dcb259e2.css
9 - dist/html/fonts/icomoon.eot
10 - dist/html/fonts/icomoon.svg
11 - dist/html/fonts/icomoon.ttf
12 - dist/html/fonts/icomoon.woff
13 - dist/search_items-4b5c56ebbb.js
14 - dist/sidebar_items-0dddf5bac7.js
7 + dist/app-bd1cb213813bf4825aa2.js
8 + dist/app-bd1cb213813bf4825aa2.js.LICENSE.txt
9 + dist/elixir-b6f1ed5df9b1d42a7309.css
10 + dist/html/fonts/remixicon.eot
11 + dist/html/fonts/remixicon.svg
12 + dist/html/fonts/remixicon.ttf
13 + dist/html/fonts/remixicon.woff
14 + dist/html/fonts/remixicon.woff2
15 + dist/search_items-faad5a62ff.js
16 + dist/sidebar_items-91456105f1.js
15 17 index.html
16 18 readme.html
17 19 search.html
  @@ -4,17 +4,17 @@
4 4 <meta charset="utf-8">
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 - <meta name="generator" content="ExDoc v0.24.1">
8 - <meta name="project" content="Consul Config Provider v0.2.3">
7 + <meta name="generator" content="ExDoc v0.28.4">
8 + <meta name="project" content="Consul Config Provider v0.2.4">
9 9
10 - <title>404 — Consul Config Provider v0.2.3</title>
11 - <link rel="stylesheet" href="dist/elixir-a172fe91e725dcb259e2.css" />
10 + <title>404 — Consul Config Provider v0.2.4</title>
11 + <link rel="stylesheet" href="dist/elixir-b6f1ed5df9b1d42a7309.css" />
12 12
13 - <script src="dist/sidebar_items-0dddf5bac7.js"></script>
13 + <script src="dist/sidebar_items-91456105f1.js"></script>
14 14
15 15 <script src="docs_config.js"></script>
16 16
17 - <script async src="dist/app-f27ff079945e43879c46.js"></script>
17 + <script async src="dist/app-bd1cb213813bf4825aa2.js"></script>
18 18
19 19
20 20 </head>
  @@ -22,27 +22,34 @@
22 22 <script>
23 23
24 24 try {
25 - if (localStorage.getItem('night-mode') === 'true') {
26 - document.body.classList.add('night-mode');
25 + var settings = JSON.parse(localStorage.getItem('ex_doc:settings') || '{}');
26 +
27 + if (settings.theme === 'dark' ||
28 + ((settings.theme === 'system' || settings.theme == null) &&
29 + window.matchMedia('(prefers-color-scheme: dark)').matches)
30 + ) {
31 + document.body.classList.add('dark')
27 32 }
28 33 } catch (error) { }
29 34 </script>
30 35
31 36 <div class="main">
32 37
33 - <button class="sidebar-button sidebar-toggle">
34 - <span class="icon-menu" title="Collapse/expand sidebar"></span>
35 - </button>
36 38
37 39 <section class="sidebar">
40 + <button class="sidebar-button sidebar-toggle" aria-label="toggle sidebar">
41 + <i class="ri-menu-line ri-lg" title="Collapse/expand sidebar"></i>
42 + </button>
43 +
38 44 <form class="sidebar-search" action="search.html">
39 45 <button type="submit" class="search-button" aria-label="Submit Search">
40 - <span class="icon-search" aria-hidden="true" title="Submit search"></span>
46 + <i class="ri-search-2-line" aria-hidden="true" title="Submit search"></i>
41 47 </button>
42 48 <button type="button" tabindex="-1" class="search-close-button" aria-label="Cancel Search">
43 - <span class="icon-cross" aria-hidden="true" title="Cancel search"></span>
49 + <i class="ri-close-line ri-lg" aria-hidden="true" title="Cancel search"></i>
44 50 </button>
45 51 <label class="search-label">
52 + <p class="sr-only">Search</p>
46 53 <input name="q" type="text" class="search-input" placeholder="Search..." aria-label="Input your search terms" autocomplete="off" />
47 54 </label>
48 55 </form>
  @@ -53,33 +60,41 @@
53 60 </div>
54 61
55 62 <div class="sidebar-header">
63 +
56 64 <div class="sidebar-projectDetails">
57 - <a href="https://github.com/blueshift-labs/consul_config_provider" class="sidebar-projectName">
65 + <a href="https://github.com/blueshift-labs/consul_config_provider" class="sidebar-projectName" translate="no">
58 66 Consul Config Provider
59 67 </a>
60 - <strong class="sidebar-projectVersion">
61 - v0.2.3
68 + <strong class="sidebar-projectVersion" translate="no">
69 + v0.2.4
62 70 </strong>
63 71 </div>
72 + <ul class="sidebar-listNav">
73 + <li><a id="extras-list-link" href="#full-list">Pages</a></li>
64 74
75 + <li><a id="modules-list-link" href="#full-list">Modules</a></li>
76 +
77 +
78 + </ul>
65 79 </div>
66 80
67 - <ul class="sidebar-listNav">
68 - <li><a id="extras-list-link" href="#full-list">Pages</a></li>
69 -
70 - <li><a id="modules-list-link" href="#full-list">Modules</a></li>
71 -
72 -
73 - </ul>
74 81 <div class="gradient"></div>
75 82 <ul id="full-list" class="sidebar-fullList"></ul>
76 83 </section>
77 84
78 85 <section class="content">
86 + <output role="status" id="toast"></output>
79 87 <div class="content-outer">
80 88 <div id="content" class="content-inner">
81 89
82 - <h2>Page not found</h2>
90 + <h1>
91 + <button class="settings display-settings">
92 + <i class="ri-settings-3-line"></i>
93 + <span class="sr-only">Settings</span>
94 + </button>
95 +
96 + <span>Page not found</span>
97 + </h1>
83 98
84 99 <p>Sorry, but the page you were trying to get to, does not exist. You
85 100 may want to try searching this site using the sidebar
  @@ -88,34 +103,27 @@ may want to try searching this site using the sidebar
88 103
89 104 to find what you were looking for.</p>
90 105 <footer class="footer">
91 - <p>
92 - <span class="line">
93 - Built using
94 - <a href="https://github.com/elixir-lang/ex_doc" title="ExDoc" target="_blank" rel="help noopener">ExDoc</a> (v0.24.1) for the
95 - <a href="https://elixir-lang.org" title="Elixir" target="_blank">Elixir programming language</a>.
96 - </span>
97 - <span class="line">
98 - Designed by
99 - <a href="https://twitter.com/dignifiedquire" target="_blank" rel="noopener" title="@dignifiedquire">Friedel Ziegelmayer</a>.
100 - </span>
101 - </p>
102 - <p>
103 106
104 - <a href="api-reference.html" title="API reference" class="line footer-button">API Reference</a>
107 + <p>
108 + On Hex.pm:
109 +
110 + <span class="line">
111 + <a href="https://hex.pm/packages/consul_config_provider/0.2.4" class="line footer-hex-package">Package</a>
112 + <a href="https://preview.hex.pm/preview/consul_config_provider/0.2.4" class="line">Preview</a>
113 +
114 + </span>
115 +
116 + <button class="line footer-button display-quick-switch">
117 + Search
118 + </button>
119 + </p>
120 +
121 + <p>
122 + Built using
123 + <a href="https://github.com/elixir-lang/ex_doc" title="ExDoc" target="_blank" rel="help noopener" translate="no">ExDoc</a> (v0.28.4) for the
124 +
125 + <a href="https://elixir-lang.org" title="Elixir" target="_blank" translate="no">Elixir programming language</a>
105 126
106 - <button class="line footer-button display-shortcuts-help">
107 - Display keyboard shortcuts
108 - </button>
109 - <button class="line footer-button night-mode-toggle">
110 - Toggle night mode
111 - </button>
112 - <button class="line footer-button display-quick-switch">
113 - Go to a HexDocs package
114 - </button>
115 - <button class="line footer-button tooltips-toggle">
116 - <span class="tooltips-option-disable">Disable tooltips</span>
117 - <span class="tooltips-option-enable">Enable tooltips</span>
118 - </button>
119 127 </p>
120 128 </footer>
121 129 </div>
Failed to load diff
  @@ -0,0 +1,147 @@
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.28.4">
8 + <meta name="project" content="Consul Config Provider v0.2.4">
9 +
10 + <title>ConsulConfigProvider.Client.Finch — Consul Config Provider v0.2.4</title>
11 + <link rel="stylesheet" href="dist/elixir-b6f1ed5df9b1d42a7309.css" />
12 +
13 + <script src="dist/sidebar_items-91456105f1.js"></script>
14 +
15 + <script src="docs_config.js"></script>
16 +
17 + <script async src="dist/app-bd1cb213813bf4825aa2.js"></script>
18 +
19 +
20 + </head>
21 + <body data-type="modules">
22 + <script>
23 +
24 + try {
25 + var settings = JSON.parse(localStorage.getItem('ex_doc:settings') || '{}');
26 +
27 + if (settings.theme === 'dark' ||
28 + ((settings.theme === 'system' || settings.theme == null) &&
29 + window.matchMedia('(prefers-color-scheme: dark)').matches)
30 + ) {
31 + document.body.classList.add('dark')
32 + }
33 + } catch (error) { }
34 + </script>
35 +
36 + <div class="main">
37 +
38 +
39 + <section class="sidebar">
40 + <button class="sidebar-button sidebar-toggle" aria-label="toggle sidebar">
41 + <i class="ri-menu-line ri-lg" title="Collapse/expand sidebar"></i>
42 + </button>
43 +
44 + <form class="sidebar-search" action="search.html">
45 + <button type="submit" class="search-button" aria-label="Submit Search">
46 + <i class="ri-search-2-line" aria-hidden="true" title="Submit search"></i>
47 + </button>
48 + <button type="button" tabindex="-1" class="search-close-button" aria-label="Cancel Search">
49 + <i class="ri-close-line ri-lg" aria-hidden="true" title="Cancel search"></i>
50 + </button>
51 + <label class="search-label">
52 + <p class="sr-only">Search</p>
53 + <input name="q" type="text" class="search-input" placeholder="Search..." aria-label="Input your search terms" autocomplete="off" />
54 + </label>
55 + </form>
56 +
57 + <div class="autocomplete">
58 + <div class="autocomplete-results">
59 + </div>
60 + </div>
61 +
62 + <div class="sidebar-header">
63 +
64 + <div class="sidebar-projectDetails">
65 + <a href="https://github.com/blueshift-labs/consul_config_provider" class="sidebar-projectName" translate="no">
66 + Consul Config Provider
67 + </a>
68 + <strong class="sidebar-projectVersion" translate="no">
69 + v0.2.4
70 + </strong>
71 + </div>
72 + <ul class="sidebar-listNav">
73 + <li><a id="extras-list-link" href="#full-list">Pages</a></li>
74 +
75 + <li><a id="modules-list-link" href="#full-list">Modules</a></li>
76 +
77 +
78 + </ul>
79 + </div>
80 +
81 + <div class="gradient"></div>
82 + <ul id="full-list" class="sidebar-fullList"></ul>
83 + </section>
84 +
85 + <section class="content">
86 + <output role="status" id="toast"></output>
87 + <div class="content-outer">
88 + <div id="content" class="content-inner">
89 +
90 + <h1>
91 + <button class="settings display-settings">
92 + <i class="ri-settings-3-line"></i>
93 + <span class="sr-only">Settings</span>
94 + </button>
95 +
96 +
97 + <a href="https://github.com/blueshift-labs/consul_config_provider/blob/main/lib/client/finch.ex#L1" title="View Source" class="view-source" rel="help">
98 + <i class="ri-code-s-slash-line" aria-hidden="true"></i>
99 + <span class="sr-only">View Source</span>
100 + </a>
101 +
102 + <span translate="no">ConsulConfigProvider.Client.Finch</span>
103 + <small class="app-vsn" translate="no">(Consul Config Provider v0.2.4)</small>
104 +
105 + </h1>
106 +
107 +
108 + <section id="moduledoc">
109 + <p>Http client using finch</p>
110 + </section>
111 +
112 +
113 +
114 + <footer class="footer">
115 +
116 + <p>
117 + On Hex.pm:
118 +
119 + <span class="line">
120 + <a href="https://hex.pm/packages/consul_config_provider/0.2.4" class="line footer-hex-package">Package</a>
121 + <a href="https://preview.hex.pm/preview/consul_config_provider/0.2.4" class="line">Preview</a>
122 +
123 + <a href="https://preview.hex.pm/preview/consul_config_provider/0.2.4/show/lib/client/finch.ex">(current file)</a>
124 +
125 + </span>
126 +
127 + <button class="line footer-button display-quick-switch">
128 + Search
129 + </button>
130 + </p>
131 +
132 + <p>
133 + Built using
134 + <a href="https://github.com/elixir-lang/ex_doc" title="ExDoc" target="_blank" rel="help noopener" translate="no">ExDoc</a> (v0.28.4) for the
135 +
136 + <a href="https://elixir-lang.org" title="Elixir" target="_blank" translate="no">Elixir programming language</a>
137 +
138 + </p>
139 + </footer>
140 + </div>
141 + </div>
142 + </section>
143 + </div>
144 +
145 +
146 + </body>
147 + </html>
Loading more files…