secret_garden 0.2.0 → 0.2.1

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
- SHA1:
3
- metadata.gz: ca493149bd63da515449929249799fe0981ece1a
4
- data.tar.gz: 35878f94653960d6208b1597a6f6de22a6f1a600
2
+ SHA256:
3
+ metadata.gz: d8ecf43d78e66640973ad649de512f520759e5c7c818216b0419997adf2e23f6
4
+ data.tar.gz: 193132a07e3f86f6733d8c80fbd350084f43f450fa463a3b3b5bce3d9dad476f
5
5
  SHA512:
6
- metadata.gz: 6eaba9b4f1768f8f356b70c8f1bcaf03bfe0352ab6f222810b2d0112febf2e73d967441db1ca8ae19ad38b5d1258f849279fbaa5c76869f2cddac8928b2dcaf1
7
- data.tar.gz: 3a7064f49de9681177d03ac66e3d35bd8124f9499675da1205ae363c447d529ab390594ca4f84294ec9fc4d0140a11554cffff400cbccd03e99eea3575a25617
6
+ metadata.gz: af0ff71ae25000c686b945a71fb2d2f1479c57da4de20201995f011c82cf904d0b82d9083a997115667ec750e74e67345a866752e413ea7fac6d799a00febe84
7
+ data.tar.gz: 32bd90d2e484da0b17d219839669ae8ff2813987f363278a8c141ae66d6e0585270544d96622ce03bd36cf19e4a95606095a1bf9124d14581077742b9fe29310
data/README.md CHANGED
@@ -74,6 +74,18 @@ require 'vault'
74
74
  SecretGarden.export 'DATABASE_URL'
75
75
  ```
76
76
 
77
+ ### Vault configurations
78
+
79
+ For vault, you may want to specify retry behavior. You can do this with:
80
+
81
+ ```
82
+ SecretGarden.add_backend :vault,
83
+ with_retries: [
84
+ Vault::HTTPConnectionError,
85
+ attempts: 42
86
+ ]
87
+ ```
88
+
77
89
  ## Development
78
90
 
79
91
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -6,9 +6,12 @@ module SecretGarden
6
6
 
7
7
  attr_accessor :map, :cache
8
8
 
9
- def initialize(map)
9
+ def initialize(map, **options)
10
10
  self.map = map
11
11
  self.cache = {}
12
+ options.each do |key, val|
13
+ send "#{key}=", val
14
+ end
12
15
  end
13
16
 
14
17
  def fetch_and_cache(name)
@@ -9,6 +9,9 @@ module SecretGarden
9
9
  class SecretNotDefined < StandardError; end
10
10
  class PropertyNotDefined < StandardError; end
11
11
 
12
+ # Options for SecretGarden.add_backend
13
+ attr_accessor :with_retries
14
+
12
15
  def fetch(secret)
13
16
  unless vault_secret = fetch_from_vault(secret.path)
14
17
  raise SecretNotDefined,
@@ -24,7 +27,13 @@ module SecretGarden
24
27
  end
25
28
 
26
29
  def fetch_from_vault(path)
27
- ::Vault.logical.read path
30
+ if with_retries
31
+ ::Vault.with_retries(*with_retries) do
32
+ ::Vault.logical.read path
33
+ end
34
+ else
35
+ ::Vault.logical.read path
36
+ end
28
37
  end
29
38
 
30
39
  end
@@ -1,3 +1,3 @@
1
1
  module SecretGarden
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/secret_garden.rb CHANGED
@@ -7,9 +7,9 @@ module SecretGarden
7
7
 
8
8
  class SecretNotDefined < StandardError; end
9
9
 
10
- def self.add_backend(val)
10
+ def self.add_backend(val, **options)
11
11
  klass = SecretGarden.const_get(val.to_s.capitalize)
12
- @backends = backends + [klass.new(map)]
12
+ @backends = backends + [klass.new(map, **options)]
13
13
  nil
14
14
  end
15
15
 
@@ -6,12 +6,12 @@ require 'secret_garden/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "secret_garden"
8
8
  spec.version = SecretGarden::VERSION
9
- spec.authors = ["Derek Kastner"]
10
- spec.email = ["dkastner@gmail.com"]
9
+ spec.authors = ["Erica Kastner"]
10
+ spec.email = ["ekastner@mailbox.org"]
11
11
 
12
12
  spec.summary = %q{Access your 12-factor app secrets securely}
13
13
  spec.description = %q{Provide secrets either via ENV or fall back to secure backends like vault}
14
- spec.homepage = "http://github.com/dkastner/secret_garden"
14
+ spec.homepage = "http://github.com/erithmetic/secret_garden"
15
15
 
16
16
  spec.license = "MIT"
17
17
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: secret_garden
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
- - Derek Kastner
7
+ - Erica Kastner
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-22 00:00:00.000000000 Z
11
+ date: 2019-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -68,7 +68,7 @@ dependencies:
68
68
  version: '0'
69
69
  description: Provide secrets either via ENV or fall back to secure backends like vault
70
70
  email:
71
- - dkastner@gmail.com
71
+ - ekastner@mailbox.org
72
72
  executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
@@ -90,7 +90,7 @@ files:
90
90
  - lib/secret_garden/vault.rb
91
91
  - lib/secret_garden/version.rb
92
92
  - secret_garden.gemspec
93
- homepage: http://github.com/dkastner/secret_garden
93
+ homepage: http://github.com/erithmetic/secret_garden
94
94
  licenses:
95
95
  - MIT
96
96
  metadata: {}
@@ -109,8 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  requirements: []
112
- rubyforge_project:
113
- rubygems_version: 2.5.1
112
+ rubygems_version: 3.0.1
114
113
  signing_key:
115
114
  specification_version: 4
116
115
  summary: Access your 12-factor app secrets securely