rubyconfig-vault 0.1.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/config/vault/vault_source.rb +21 -0
- data/lib/config/vault/version.rb +2 -2
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b468333af49d93bac42b51514158c5d3867604ca9aa7c64ac7a6ce02421821b9
|
4
|
+
data.tar.gz: ea5200b58941e1dab0fdf9cc09fa7532fda3b054702994d0b28081b259be0a5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a06193b680915812e77b1632ca04c54aaedea10d99b3894f36737f97028f5321c2e844f5030746285b9bfea08e97c1ee9272764c97b896de546a8485a63c5e3
|
7
|
+
data.tar.gz: 756beb031fcc04827054e8ddc8b3c8077cb86d9cd5488bed1021f0994bf3477717370650c23f65512e3b880fef9dd9b8d8dd29afa09babfddc79470b313ae46f
|
@@ -2,10 +2,17 @@ require 'vault'
|
|
2
2
|
|
3
3
|
module Config
|
4
4
|
module Sources
|
5
|
+
# A vault source for Config
|
5
6
|
class VaultSource
|
6
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) || ''
|
@@ -14,18 +21,32 @@ module Config
|
|
14
21
|
@client = Vault::Client.new(client_opts)
|
15
22
|
end
|
16
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]
|
17
31
|
def add_path(path)
|
18
32
|
@paths << path
|
19
33
|
end
|
20
34
|
|
35
|
+
# Remove added paths
|
21
36
|
def clear_paths
|
22
37
|
@paths = []
|
23
38
|
end
|
24
39
|
|
40
|
+
# Load data from source into hash
|
41
|
+
#
|
42
|
+
# @return [Hash]
|
25
43
|
def load
|
26
44
|
process_paths
|
27
45
|
end
|
28
46
|
|
47
|
+
# Client reference for quick operations
|
48
|
+
#
|
49
|
+
# @return [Vault::KV, Vault:Logical]
|
29
50
|
def client
|
30
51
|
unless kv.empty?
|
31
52
|
@client.kv(@kv)
|
data/lib/config/vault/version.rb
CHANGED
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.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Young
|
@@ -96,6 +96,7 @@ metadata:
|
|
96
96
|
allowed_push_host: https://rubygems.org
|
97
97
|
homepage_uri: https://github.com/CrunchwrapSupreme/rubyconfig-vault
|
98
98
|
source_code_uri: https://github.com/CrunchwrapSupreme/rubyconfig-vault
|
99
|
+
documentation_uri: https://www.rubydoc.info/gems/rubyconfig-vault/index
|
99
100
|
post_install_message:
|
100
101
|
rdoc_options: []
|
101
102
|
require_paths:
|