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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7ead46208a975e2279ea04ab4be4ffd2cdbce98b
4
- data.tar.gz: 38a1bb1d2ab90c857cba5648abfe4e65b412c347
3
+ metadata.gz: 020a0c30850b39d3800425f57a13108618dab7ec
4
+ data.tar.gz: 7e4b28dceb3ebbb4899bacfa7d770cce7311dc39
5
5
  SHA512:
6
- metadata.gz: 8edd7034055c5dcb94fd52fe2d9a6760ac218a2134f195ab1dbbda4e1ae548ff016c1ecee9f430cc256f677a2f02fe5a26f0215762cbc5348f6b8dbd6395f9b7
7
- data.tar.gz: f10c1c54cbf8cb0f55c421e6577e90e792041ce2b830adee64e91ed17ab999a49f13cb1e3fc6b6959e578cd41dda8371d1cab8fbd09270352c04d80e6f83eee8
6
+ metadata.gz: 471b88a8a4627e61ec8fabcbb6d8ade5cf86b6359dde655377041d4b5cab59e6df13ed7513617a556dd96ef557ae69d1d228f3d8010be2eea3ff4c252818fe20
7
+ data.tar.gz: 6e9b59837693ab38a5d16707c8709ce438966b8d10ad307918cc6e1fda78104ce0e8575ddde0abb03548028bd4727804c820405eeac5c46bf4f972a5626f019c
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'hako-etcenv'
7
- spec.version = '0.1.2'
7
+ spec.version = '0.2.0'
8
8
  spec.authors = ['Kohei Suzuki']
9
9
  spec.email = ['eagletmt@gmail.com']
10
10
 
@@ -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
- @etcd = Etcd.client(
19
- host: uri.host,
20
- port: uri.port,
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(@etcd, @root).expanded_env.each do |key, val|
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.1.2
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: 2016-01-19 00:00:00.000000000 Z
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.4.5.1
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