consult 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/.travis.yml +7 -7
- data/CHANGELOG.md +7 -0
- data/README.md +16 -11
- data/consult.gemspec +2 -2
- data/docker-compose.yml +14 -0
- data/lib/consult.rb +1 -1
- data/lib/consult/version.rb +1 -1
- metadata +12 -11
- data/Gemfile.lock +0 -106
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aa590a02bf4aceb2c3b04e21c5737d1b7e86160db8cb1251c79dcf612eba6e9f
|
|
4
|
+
data.tar.gz: 29e80de8a03c8c52eb156dcabaed67b43bad22997e6c3532994d177afce5d4b0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8d6aebe85871c232f97e9b760c811b18e98488149214fe9c7b3f618b601e69323ba6f2c30ff270afd6d68a5783492407cbc1446e455efccc1d031c0a880a3a44
|
|
7
|
+
data.tar.gz: 532d19aaf161adb255f1179958814d03f1d9ced811c4405dcd2f66244589aa58c08e83583b84720feb6a8d6187f3a991076d7d4524c81b27bcddaf38716354e3
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
sudo: false
|
|
2
2
|
language: ruby
|
|
3
3
|
rvm:
|
|
4
|
-
- 2.5
|
|
5
|
-
- 2.4
|
|
4
|
+
- 2.5
|
|
5
|
+
- 2.4
|
|
6
|
+
- 2.3
|
|
6
7
|
|
|
7
8
|
services:
|
|
8
9
|
- docker
|
|
9
10
|
|
|
10
11
|
before_install:
|
|
11
|
-
- gem install bundler -v 1.16.
|
|
12
|
-
- docker
|
|
13
|
-
- docker
|
|
14
|
-
- docker
|
|
15
|
-
- docker run -d --name=dev-vault -p 8200:8200 --cap-add=IPC_LOCK -e 'VAULT_DEV_ROOT_TOKEN_ID=94e1a9ed-5d72-5677-27ab-ebc485cca368' vault
|
|
12
|
+
- gem install bundler -v 1.16.2
|
|
13
|
+
- docker-compose --version
|
|
14
|
+
- docker-compose up -d
|
|
15
|
+
- docker ps
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Consult
|
|
2
2
|
|
|
3
|
+
[](https://badge.fury.io/rb/consult)
|
|
4
|
+
[](https://travis-ci.org/veracross/consult)
|
|
5
|
+
[](https://codeclimate.com/github/veracross/consult/maintainability)
|
|
6
|
+
|
|
3
7
|
Render configuration and secrets from [Consul] and [Vault] with ERB templates.
|
|
4
8
|
|
|
5
9
|
This gem is a spiritual sibling to [Consul Template], but specifically intended for use in Ruby or Rails environments. It does not have the same features as Consul Template; it is intended for simpler scenarios. Most importantly, leases and configuration changes are _not_ watched to automatically re-render. Consult is intended for more static or medium-to-long lived configuration.
|
|
@@ -55,24 +59,24 @@ vault:
|
|
|
55
59
|
# Enumerate the templates.
|
|
56
60
|
templates:
|
|
57
61
|
database:
|
|
58
|
-
# Relative paths are assumed to be in #{Rails.root}
|
|
62
|
+
# Relative paths are assumed to be in #{Rails.root}.
|
|
59
63
|
# Path to the template
|
|
60
|
-
path: templates/database.yml.erb
|
|
64
|
+
path: config/templates/database.yml.erb
|
|
61
65
|
# Destination for the rendered template
|
|
62
|
-
dest:
|
|
66
|
+
dest: config/database.yml
|
|
63
67
|
# Which environments to render this template in
|
|
64
68
|
environments: all
|
|
65
69
|
# If the file is less than this old, do not re-render
|
|
66
70
|
ttl: 3600 # seconds
|
|
67
71
|
|
|
68
72
|
secrets:
|
|
69
|
-
path: templates/secrets.yml.erb
|
|
70
|
-
dest:
|
|
73
|
+
path: config/templates/secrets.yml.erb
|
|
74
|
+
dest: config/secrets.yml
|
|
71
75
|
environments: test
|
|
72
76
|
|
|
73
77
|
should_be_excluded:
|
|
74
|
-
path: templates/fake.yml.erb
|
|
75
|
-
dest:
|
|
78
|
+
path: config/templates/fake.yml.erb
|
|
79
|
+
dest: config/fake.yml
|
|
76
80
|
environments: production # won't be rendered because it doesn't match `env` at the top
|
|
77
81
|
```
|
|
78
82
|
|
|
@@ -135,6 +139,10 @@ returns
|
|
|
135
139
|
|
|
136
140
|
**secret(path)** - Fetch a secret at the given path.
|
|
137
141
|
|
|
142
|
+
# Vault KV v2
|
|
143
|
+
username: <%= secret('secret/data/credentials').data.dig(:data, :username) %>
|
|
144
|
+
|
|
145
|
+
# Vault KV v1
|
|
138
146
|
username: <%= secret('secret/credentials').data[:username] %>
|
|
139
147
|
|
|
140
148
|
yields
|
|
@@ -269,10 +277,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
|
269
277
|
|
|
270
278
|
Testing is easiest by running Consul and Vault in Docker. Just boot up their minimal containers:
|
|
271
279
|
|
|
272
|
-
$ docker
|
|
273
|
-
$ docker pull vault
|
|
274
|
-
$ docker run -d --name=dev-consul -p 8500:8500 consul
|
|
275
|
-
$ docker run -d --name=dev-vault -p 8200:8200 --cap-add=IPC_LOCK -e 'VAULT_DEV_ROOT_TOKEN_ID=94e1a9ed-5d72-5677-27ab-ebc485cca368' vault
|
|
280
|
+
$ docker-compose up
|
|
276
281
|
|
|
277
282
|
Then run `bundle exec rspec`, or `bundle exec guard`.
|
|
278
283
|
|
data/consult.gemspec
CHANGED
|
@@ -25,8 +25,8 @@ Gem::Specification.new do |spec|
|
|
|
25
25
|
spec.require_paths = ['lib']
|
|
26
26
|
|
|
27
27
|
spec.add_dependency 'activesupport', '> 4', '< 6'
|
|
28
|
-
spec.add_dependency 'diplomat'
|
|
29
|
-
spec.add_dependency 'vault'
|
|
28
|
+
spec.add_dependency 'diplomat', '~> 2.0.2'
|
|
29
|
+
spec.add_dependency 'vault', '~> 0.10.1'
|
|
30
30
|
|
|
31
31
|
spec.add_development_dependency 'bundler', '~> 1.16'
|
|
32
32
|
spec.add_development_dependency 'byebug'
|
data/docker-compose.yml
ADDED
data/lib/consult.rb
CHANGED
data/lib/consult/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: consult
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeff Fraser
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-07-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -34,30 +34,30 @@ dependencies:
|
|
|
34
34
|
name: diplomat
|
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
|
-
- - "
|
|
37
|
+
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version:
|
|
39
|
+
version: 2.0.2
|
|
40
40
|
type: :runtime
|
|
41
41
|
prerelease: false
|
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
|
-
- - "
|
|
44
|
+
- - "~>"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version:
|
|
46
|
+
version: 2.0.2
|
|
47
47
|
- !ruby/object:Gem::Dependency
|
|
48
48
|
name: vault
|
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
|
-
- - "
|
|
51
|
+
- - "~>"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version:
|
|
53
|
+
version: 0.10.1
|
|
54
54
|
type: :runtime
|
|
55
55
|
prerelease: false
|
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
57
|
requirements:
|
|
58
|
-
- - "
|
|
58
|
+
- - "~>"
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version:
|
|
60
|
+
version: 0.10.1
|
|
61
61
|
- !ruby/object:Gem::Dependency
|
|
62
62
|
name: bundler
|
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -181,8 +181,8 @@ files:
|
|
|
181
181
|
- ".rspec"
|
|
182
182
|
- ".rubocop.yml"
|
|
183
183
|
- ".travis.yml"
|
|
184
|
+
- CHANGELOG.md
|
|
184
185
|
- Gemfile
|
|
185
|
-
- Gemfile.lock
|
|
186
186
|
- Guardfile
|
|
187
187
|
- LICENSE.txt
|
|
188
188
|
- Procfile
|
|
@@ -191,6 +191,7 @@ files:
|
|
|
191
191
|
- bin/console
|
|
192
192
|
- bin/setup
|
|
193
193
|
- consult.gemspec
|
|
194
|
+
- docker-compose.yml
|
|
194
195
|
- lib/consult.rb
|
|
195
196
|
- lib/consult/rails/engine.rb
|
|
196
197
|
- lib/consult/template.rb
|
data/Gemfile.lock
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
consult (0.5.0)
|
|
5
|
-
activesupport (> 4, < 6)
|
|
6
|
-
diplomat
|
|
7
|
-
vault
|
|
8
|
-
|
|
9
|
-
GEM
|
|
10
|
-
remote: https://rubygems.org/
|
|
11
|
-
specs:
|
|
12
|
-
activesupport (5.1.4)
|
|
13
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
14
|
-
i18n (~> 0.7)
|
|
15
|
-
minitest (~> 5.1)
|
|
16
|
-
tzinfo (~> 1.1)
|
|
17
|
-
byebug (9.1.0)
|
|
18
|
-
coderay (1.1.2)
|
|
19
|
-
concurrent-ruby (1.0.5)
|
|
20
|
-
diff-lcs (1.3)
|
|
21
|
-
diplomat (2.0.2)
|
|
22
|
-
faraday (~> 0.9)
|
|
23
|
-
json
|
|
24
|
-
docile (1.1.5)
|
|
25
|
-
faraday (0.14.0)
|
|
26
|
-
multipart-post (>= 1.2, < 3)
|
|
27
|
-
ffi (1.9.18)
|
|
28
|
-
formatador (0.2.5)
|
|
29
|
-
guard (2.14.1)
|
|
30
|
-
formatador (>= 0.2.4)
|
|
31
|
-
listen (>= 2.7, < 4.0)
|
|
32
|
-
lumberjack (~> 1.0)
|
|
33
|
-
nenv (~> 0.1)
|
|
34
|
-
notiffany (~> 0.0)
|
|
35
|
-
pry (>= 0.9.12)
|
|
36
|
-
shellany (~> 0.0)
|
|
37
|
-
thor (>= 0.18.1)
|
|
38
|
-
guard-compat (1.2.1)
|
|
39
|
-
guard-rspec (4.7.3)
|
|
40
|
-
guard (~> 2.1)
|
|
41
|
-
guard-compat (~> 1.1)
|
|
42
|
-
rspec (>= 2.99.0, < 4.0)
|
|
43
|
-
i18n (0.9.5)
|
|
44
|
-
concurrent-ruby (~> 1.0)
|
|
45
|
-
json (2.1.0)
|
|
46
|
-
listen (3.1.5)
|
|
47
|
-
rb-fsevent (~> 0.9, >= 0.9.4)
|
|
48
|
-
rb-inotify (~> 0.9, >= 0.9.7)
|
|
49
|
-
ruby_dep (~> 1.2)
|
|
50
|
-
lumberjack (1.0.12)
|
|
51
|
-
method_source (0.9.0)
|
|
52
|
-
minitest (5.11.3)
|
|
53
|
-
multipart-post (2.0.0)
|
|
54
|
-
nenv (0.3.0)
|
|
55
|
-
notiffany (0.1.1)
|
|
56
|
-
nenv (~> 0.1)
|
|
57
|
-
shellany (~> 0.0)
|
|
58
|
-
pry (0.11.3)
|
|
59
|
-
coderay (~> 1.1.0)
|
|
60
|
-
method_source (~> 0.9.0)
|
|
61
|
-
rake (10.5.0)
|
|
62
|
-
rb-fsevent (0.10.2)
|
|
63
|
-
rb-inotify (0.9.10)
|
|
64
|
-
ffi (>= 0.5.0, < 2)
|
|
65
|
-
rspec (3.7.0)
|
|
66
|
-
rspec-core (~> 3.7.0)
|
|
67
|
-
rspec-expectations (~> 3.7.0)
|
|
68
|
-
rspec-mocks (~> 3.7.0)
|
|
69
|
-
rspec-core (3.7.0)
|
|
70
|
-
rspec-support (~> 3.7.0)
|
|
71
|
-
rspec-expectations (3.7.0)
|
|
72
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
73
|
-
rspec-support (~> 3.7.0)
|
|
74
|
-
rspec-mocks (3.7.0)
|
|
75
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
76
|
-
rspec-support (~> 3.7.0)
|
|
77
|
-
rspec-support (3.7.0)
|
|
78
|
-
ruby_dep (1.5.0)
|
|
79
|
-
shellany (0.0.1)
|
|
80
|
-
simplecov (0.15.1)
|
|
81
|
-
docile (~> 1.1.0)
|
|
82
|
-
json (>= 1.8, < 3)
|
|
83
|
-
simplecov-html (~> 0.10.0)
|
|
84
|
-
simplecov-html (0.10.2)
|
|
85
|
-
thor (0.20.0)
|
|
86
|
-
thread_safe (0.3.6)
|
|
87
|
-
tzinfo (1.2.5)
|
|
88
|
-
thread_safe (~> 0.1)
|
|
89
|
-
vault (0.10.1)
|
|
90
|
-
|
|
91
|
-
PLATFORMS
|
|
92
|
-
ruby
|
|
93
|
-
|
|
94
|
-
DEPENDENCIES
|
|
95
|
-
bundler (~> 1.16)
|
|
96
|
-
byebug
|
|
97
|
-
consult!
|
|
98
|
-
guard
|
|
99
|
-
guard-rspec
|
|
100
|
-
pry
|
|
101
|
-
rake (~> 10.0)
|
|
102
|
-
rspec (~> 3.0)
|
|
103
|
-
simplecov
|
|
104
|
-
|
|
105
|
-
BUNDLED WITH
|
|
106
|
-
1.16.1
|