sekreto 0.1.2 → 0.1.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: 33773c6654dfdf9085a776c458cad342ba2340dae4dbd3ee668a7c25c4050ede
4
- data.tar.gz: af2b7091cef29d632baf9ab23d849b37bd786c9095ffc2088910df3db12dcb89
3
+ metadata.gz: ab381faa21b251cd3abadcc6c2d854dac68a4f9af5d2a507b6eb060f67bdd385
4
+ data.tar.gz: 97760f0f1a7cecf45bfa98263b3be0a0f7144227f82fbc0eff2fd8e930b97b76
5
5
  SHA512:
6
- metadata.gz: 4c310757e2f6b32777065fd595101064c64779003b3ebc165a44f567d33abe4f947a42c959ac88d1058a1ff5f0455a197752364bfaa3eb821f3d8ab1ee55cdcd
7
- data.tar.gz: 0732c82d0b8b45947dd997be91ad6c732f418ab1686c6875cd9c3d9bef2c3fd3c0d292be5117b9730f12d1f398865e49cacfb58ba4027c9c797651cf5d3ad542
6
+ metadata.gz: 7e68a1eb57ce8c74025391b1856211e3bd1458003bc12f618e1a08bad9f0448ee1f1b8800d8294e20cfd10f82aba8adef0525b3edadbd6316f22cb874aea20f9
7
+ data.tar.gz: 7a05fbb69de6d2952fce1477d72daee5601ee6c52c46436b0eeb25aff59fe180375b17b849300c3609f0456deb5f650378dd6cdc6d3960a75c3ec5f45d9260c9
data/lib/sekreto.rb CHANGED
@@ -14,9 +14,12 @@ module Sekreto
14
14
  end
15
15
 
16
16
  def get_value(secret_id)
17
- return config.fallback_lookup.call(secret_id) unless config.is_allowed_env.call
17
+ fail 'Not allowed env' unless config.is_allowed_env.call
18
18
  response = secrets_manager.get_secret_value(secret_id: secret_name(secret_id))
19
19
  response.secret_string
20
+ rescue StandardError => err
21
+ logger.warn("[Sekreto] Failed to get value!\n#{err}")
22
+ config.fallback_lookup.call(secret_id)
20
23
  end
21
24
 
22
25
  def get_json_value(secret_id)
@@ -37,5 +40,9 @@ module Sekreto
37
40
  def secrets_manager
38
41
  config.secrets_manager
39
42
  end
43
+
44
+ def logger
45
+ config.logger
46
+ end
40
47
  end
41
48
  end
@@ -1,15 +1,19 @@
1
+ require 'logger'
2
+
1
3
  module Sekreto
2
4
  class Config
3
5
  attr_accessor :prefix
4
6
  attr_accessor :is_allowed_env
5
7
  attr_accessor :fallback_lookup
6
8
  attr_accessor :secrets_manager
9
+ attr_accessor :logger
7
10
 
8
11
  def initialize
9
12
  @prefix = 'secrets'
10
13
  @is_allowed_env = -> { true }
11
14
  @fallback_lookup = ->(secret_id) { ENV[secret_id] }
12
15
  @secrets_manager = nil
16
+ @logger = Logger.new(STDOUT)
13
17
  end
14
18
  end
15
19
  end
@@ -1,3 +1,3 @@
1
1
  module Sekreto
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.1.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sekreto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Autolist Engineering
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-30 00:00:00.000000000 Z
11
+ date: 2018-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-secretsmanager