hako-etcenv 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/hako-etcenv.gemspec +1 -1
- data/lib/hako/env_providers/etcenv.rb +20 -10
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 020a0c30850b39d3800425f57a13108618dab7ec
|
4
|
+
data.tar.gz: 7e4b28dceb3ebbb4899bacfa7d770cce7311dc39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 471b88a8a4627e61ec8fabcbb6d8ade5cf86b6359dde655377041d4b5cab59e6df13ed7513617a556dd96ef557ae69d1d228f3d8010be2eea3ff4c252818fe20
|
7
|
+
data.tar.gz: 6e9b59837693ab38a5d16707c8709ce438966b8d10ad307918cc6e1fda78104ce0e8575ddde0abb03548028bd4727804c820405eeac5c46bf4f972a5626f019c
|
data/hako-etcenv.gemspec
CHANGED
@@ -14,21 +14,16 @@ module Hako
|
|
14
14
|
unless options['root']
|
15
15
|
validation_error!('root must be set')
|
16
16
|
end
|
17
|
-
uri = URI.parse(options.fetch('url'))
|
18
|
-
@
|
19
|
-
|
20
|
-
|
21
|
-
use_ssl: uri.scheme == 'https',
|
22
|
-
ca_file: options.fetch('ca_file', nil),
|
23
|
-
ssl_cert: ssl_cert(options.fetch('ssl_cert', nil)),
|
24
|
-
ssl_key: ssl_key(options.fetch('ssl_key', nil)),
|
25
|
-
)
|
17
|
+
@uri = URI.parse(options.fetch('url'))
|
18
|
+
@ca_file = options.fetch('ca_file', nil)
|
19
|
+
@ssl_cert = options.fetch('ssl_cert', nil)
|
20
|
+
@ssl_key = options.fetch('ssl_key', nil)
|
26
21
|
@root = options.fetch('root')
|
27
22
|
end
|
28
23
|
|
29
24
|
def ask(variables)
|
30
25
|
env = {}
|
31
|
-
::Etcenv::Environment.new(
|
26
|
+
::Etcenv::Environment.new(etcd_client, @root).expanded_env.each do |key, val|
|
32
27
|
if variables.include?(key)
|
33
28
|
env[key] = val
|
34
29
|
end
|
@@ -36,8 +31,23 @@ module Hako
|
|
36
31
|
env
|
37
32
|
end
|
38
33
|
|
34
|
+
def can_ask_keys?
|
35
|
+
false
|
36
|
+
end
|
37
|
+
|
39
38
|
private
|
40
39
|
|
40
|
+
def etcd_client
|
41
|
+
@etcd_client ||= Etcd.client(
|
42
|
+
host: @uri.host,
|
43
|
+
port: @uri.port,
|
44
|
+
use_ssl: @uri.scheme == 'https',
|
45
|
+
ca_file: @ca_file,
|
46
|
+
ssl_cert: ssl_cert(@ssl_cert),
|
47
|
+
ssl_key: ssl_key(@ssl_key),
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
41
51
|
def ssl_cert(cert_path)
|
42
52
|
if cert_path
|
43
53
|
OpenSSL::X509::Certificate.new(::File.read(cert_path))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hako-etcenv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kohei Suzuki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: etcenv
|
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
116
|
version: '0'
|
117
117
|
requirements: []
|
118
118
|
rubyforge_project:
|
119
|
-
rubygems_version: 2.
|
119
|
+
rubygems_version: 2.6.10
|
120
120
|
signing_key:
|
121
121
|
specification_version: 4
|
122
122
|
summary: Provide variables from etcd to hako using etcenv
|