rubyconfig-vault 0.1.0 → 1.0.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
  SHA256:
3
- metadata.gz: 9d90484b02d5150c6c0b8904b0a4900b3a0bb1d7e83a53f863c5aee656976ea1
4
- data.tar.gz: f81e33ba21ff66e46ac33d9ec0fbb5a0cb6a795798dd4966d45be0945b9a1aa4
3
+ metadata.gz: b468333af49d93bac42b51514158c5d3867604ca9aa7c64ac7a6ce02421821b9
4
+ data.tar.gz: ea5200b58941e1dab0fdf9cc09fa7532fda3b054702994d0b28081b259be0a5f
5
5
  SHA512:
6
- metadata.gz: 804d3baeb799ca7880a2dc8d2bfa818c48b56cec25f183ff00fb55a08c2b04bd17b50b0f74127de7368cdb15a8b3aa1334a283b3fcc7b3e56777c4c2aac3f1c3
7
- data.tar.gz: 1eacd15b46baba5f31449f083f7454057e0d63faffaf7df4a2484968cb5e4240e8b713a6f132be171d663b99472408f98f49ce519484250efe8ecdf2e48805c7
6
+ metadata.gz: 7a06193b680915812e77b1632ca04c54aaedea10d99b3894f36737f97028f5321c2e844f5030746285b9bfea08e97c1ee9272764c97b896de546a8485a63c5e3
7
+ data.tar.gz: 756beb031fcc04827054e8ddc8b3c8077cb86d9cd5488bed1021f0994bf3477717370650c23f65512e3b880fef9dd9b8d8dd29afa09babfddc79470b313ae46f
@@ -2,29 +2,51 @@ require 'vault'
2
2
 
3
3
  module Config
4
4
  module Sources
5
+ # A vault source for Config
5
6
  class VaultSource
6
- attr_accessor :kv
7
+ attr_accessor :kv, :root
7
8
  attr_reader :paths, :client
8
9
 
10
+ # Create a new Config source
11
+ #
12
+ # @param [Hash] opts
13
+ # @option opts [String, nil] :kv mount point for operations
14
+ # @option opts [Array<String>, nil] :paths paths for vault secrets
15
+ # @option opts [String, Symbol, nil] :root root key for data provided by source
9
16
  def initialize(opts = {})
10
17
  client_opts = opts.clone
11
18
  @kv = client_opts.delete(:kv) || ''
12
19
  @paths = client_opts.delete(:paths) || []
20
+ @root = client_opts.delete(:root)
13
21
  @client = Vault::Client.new(client_opts)
14
22
  end
15
23
 
24
+ # Add a path to Config source
25
+ #
26
+ # @example Use glob operators
27
+ # source.add_path('secrets/**/test/*')
28
+ # source.load #=> { secrets: { some_key: { test: { secret_data: 2 } } } }
29
+ #
30
+ # @param path [String]
16
31
  def add_path(path)
17
32
  @paths << path
18
33
  end
19
34
 
35
+ # Remove added paths
20
36
  def clear_paths
21
37
  @paths = []
22
38
  end
23
39
 
40
+ # Load data from source into hash
41
+ #
42
+ # @return [Hash]
24
43
  def load
25
44
  process_paths
26
45
  end
27
46
 
47
+ # Client reference for quick operations
48
+ #
49
+ # @return [Vault::KV, Vault:Logical]
28
50
  def client
29
51
  unless kv.empty?
30
52
  @client.kv(@kv)
@@ -76,7 +98,11 @@ module Config
76
98
  end
77
99
  end
78
100
 
79
- root
101
+ if @root
102
+ { @root => root }
103
+ else
104
+ root
105
+ end
80
106
  end
81
107
 
82
108
  end
@@ -0,0 +1,5 @@
1
+ module Config
2
+ module Vault
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require "config/vault/version"
2
+ require "config/vault/vault_source"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyconfig-vault
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Young
@@ -24,6 +24,62 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.16.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: config
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 4.0.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 4.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '12.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '12.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
27
83
  description:
28
84
  email:
29
85
  - da.young@f5.com
@@ -31,15 +87,16 @@ executables: []
31
87
  extensions: []
32
88
  extra_rdoc_files: []
33
89
  files:
34
- - lib/rubyconfig/vault.rb
35
- - lib/rubyconfig/vault/vault_source.rb
36
- - lib/rubyconfig/vault/version.rb
90
+ - lib/config/vault.rb
91
+ - lib/config/vault/vault_source.rb
92
+ - lib/config/vault/version.rb
37
93
  homepage: https://github.com/CrunchwrapSupreme/rubyconfig-vault
38
94
  licenses: []
39
95
  metadata:
40
96
  allowed_push_host: https://rubygems.org
41
97
  homepage_uri: https://github.com/CrunchwrapSupreme/rubyconfig-vault
42
98
  source_code_uri: https://github.com/CrunchwrapSupreme/rubyconfig-vault
99
+ documentation_uri: https://www.rubydoc.info/gems/rubyconfig-vault/index
43
100
  post_install_message:
44
101
  rdoc_options: []
45
102
  require_paths:
@@ -48,7 +105,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
48
105
  requirements:
49
106
  - - ">="
50
107
  - !ruby/object:Gem::Version
51
- version: 2.3.0
108
+ version: 2.6.0
52
109
  required_rubygems_version: !ruby/object:Gem::Requirement
53
110
  requirements:
54
111
  - - ">="
@@ -1,5 +0,0 @@
1
- module Rubyconfig
2
- module Vault
3
- VERSION = "0.1.0"
4
- end
5
- end
@@ -1,2 +0,0 @@
1
- require "rubyconfig/vault/version"
2
- require "rubyconfig/vault/vault_source"