rubyconfig-vault 1.0.2 → 1.0.3

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
  SHA256:
3
- metadata.gz: 63279ad2f29fabd8006dd8bdf3a69e49dabd2a1d5e3f89c1c695c9e6528f5154
4
- data.tar.gz: 734327aae2db0747633a5a06101e2c2117ad54b0b441011bf4d58348da871c46
3
+ metadata.gz: 0a737c714f6c9e6cdff7bc6ea5ad1cdb864929ea00552b49c0a711bf7985571e
4
+ data.tar.gz: 54d1b1055a1272b021c3b9411fefd41c2c6ee2e6ec2469fec1382e7becbd4502
5
5
  SHA512:
6
- metadata.gz: 4b6aac24bcb3781bae89ef0bc3e77fe5da3f5ada28308c711e5f8117e193cedcf12aaf5a6576ab080521f138325052c16c5e2246011fb086b38c7407cd32a839
7
- data.tar.gz: 8455068a25f114a7a9a430e8daf25421c253f39788c673bcfd996ba208bfee086f7c5fb7d3dfd0c2f93c7349eb6792d4851b082c0753b60ebf729c04db2f2379
6
+ metadata.gz: d6810e8ed8954833fd7de46c76f1ff0102ab8240d7c25b9eed16eee421bd73703c1ae2b6ac75b1a5b36b25c5857e763ef7c73c8641a6aa305702b9716f3ba1ca
7
+ data.tar.gz: f4b0a4031bff1d623978064ddef59656b60ae9cf7071ee0a2e31665d7397b4c15ed63462a9a356b5ee7e82b2b671d2daf6a94b2969f24fb3c7e402f85e005cd6
@@ -4,7 +4,7 @@ module Config
4
4
  module Sources
5
5
  # A vault source for Config
6
6
  class VaultSource
7
- attr_accessor :kv, :root
7
+ attr_accessor :kv, :root, :flatten
8
8
  attr_reader :paths, :client
9
9
 
10
10
  # Create a new Config source, all Vault::Client parameters supported
@@ -35,7 +35,7 @@ module Config
35
35
  [p, @root]
36
36
  end
37
37
  end
38
- @client = Vault::Client.new(client_opts)
38
+ @client = ::Vault::Client.new(client_opts)
39
39
  end
40
40
 
41
41
  # Add a path to Config source
@@ -104,9 +104,11 @@ module Config
104
104
  sp = subpaths[idx]
105
105
  if sp.nil? || sp.eql?('*')
106
106
  data = client_ops.read(query_path)&.data || {}
107
- parent.merge!(data)
108
- parent.transform_keys! { |key| @map[key] || key }
109
- parent.compact!
107
+ node = root if @flatten
108
+ node = parent unless @flatten
109
+ node.merge!(data)
110
+ node.transform_keys! { |key| @map[key] || key }
111
+ node.compact!
110
112
  end
111
113
 
112
114
  if sp.eql?('**') || sp.eql?('*')
@@ -115,19 +117,18 @@ module Config
115
117
  new_parent = {}
116
118
  new_key = st.split('/').last.downcase.to_sym
117
119
  new_query_path = [query_path, st].join('/')
118
- parent[new_key] = new_parent
120
+ parent[new_key] = new_parent unless @flatten
119
121
  stack.push([new_query_path, idx + 1, new_parent])
120
122
  end
121
123
  elsif sp
122
124
  query_path = [query_path, sp].compact.join('/')
123
125
  idx += 1
124
126
  new_parent = {}
125
- parent[sp.downcase.to_sym] = new_parent
127
+ parent[sp.downcase.to_sym] = new_parent unless @flatten
126
128
  stack.push([query_path, idx, new_parent])
127
129
  end
128
130
  end
129
131
 
130
- root = root.flatten if @flatten
131
132
  if path.last
132
133
  { @root => root }
133
134
  else
@@ -1,5 +1,5 @@
1
1
  module Config
2
2
  module Vault
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyconfig-vault
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Young
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-15 00:00:00.000000000 Z
11
+ date: 2022-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vault
@@ -80,7 +80,7 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- description:
83
+ description:
84
84
  email:
85
85
  - da.young@f5.com
86
86
  executables: []
@@ -97,7 +97,7 @@ metadata:
97
97
  homepage_uri: https://github.com/CrunchwrapSupreme/rubyconfig-vault
98
98
  source_code_uri: https://github.com/CrunchwrapSupreme/rubyconfig-vault
99
99
  documentation_uri: https://www.rubydoc.info/gems/rubyconfig-vault/index
100
- post_install_message:
100
+ post_install_message:
101
101
  rdoc_options: []
102
102
  require_paths:
103
103
  - lib
@@ -112,8 +112,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  requirements: []
115
- rubygems_version: 3.0.3.1
116
- signing_key:
115
+ rubygems_version: 3.1.2
116
+ signing_key:
117
117
  specification_version: 4
118
118
  summary: Implements a ruby config source from vault
119
119
  test_files: []