figaro_secrets 0.1.0 → 0.1.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
2
  SHA256:
3
- metadata.gz: 70682fa36df97a38a8249d7f57217d249a85ef1437cf5d006619529f5c9289ad
4
- data.tar.gz: 5c9ea1a8149680bc5f8c61b2c9aab6e721dd211cd8b6a7626fef18b17160e0aa
3
+ metadata.gz: 19b37e703c80017d8dd091febb440ac6b6f32ead3b920e5fcbce01c670c4b7ac
4
+ data.tar.gz: 8ab5d1aebfd09b9f77a12c2faa24d7623d9cd18c22f2e3736f7355d46a93d9d2
5
5
  SHA512:
6
- metadata.gz: deb80b05bce5743d5f5095865e5f7583742ef9d4d38356fa15943340fa30f71102d8567097e8ec8ca6126cdb4d7339c7bdbe082ea898c243c075e3448ba04763
7
- data.tar.gz: 972c874ea77770ac3546931684f7bbc7560893c1c2cf77d5fa96398be4bd8291779741166871d4007553fbabc10b18d26eb48897e9d4525cd78b8db051f3e964
6
+ metadata.gz: fdf0c93a31bf71f48a81023cf510dc4a3d20b4fbdf8edebffc96495d9cde8014ee4234a7c5ff5f8a99e95096190ce3025124bfb0ec468fafb74f81eb1909320d
7
+ data.tar.gz: 4012f60a45d75f4c210712ce5f935381eb5b9e77acd830ab20e010d26d1fc94b52acc108c980278fed5c3239cd6cf17fd51db9dcec6869315e6726699a803dbe
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- figaro_secrets (0.1.0)
4
+ figaro_secrets (0.1.1)
5
5
  aws-sdk-secretsmanager
6
6
  figaro
7
7
 
@@ -11,6 +11,11 @@ module FigaroSecrets
11
11
  def self.log_error(message)
12
12
  Rails.logger&.error(message) || $stderr.puts(message)
13
13
  end
14
+
15
+ # Short circuit to prevent parsing secrets
16
+ def self.enabled?
17
+ ENV["FIGARO_SECRETS"] != "false"
18
+ end
14
19
  end
15
20
 
16
21
  require "figaro_secrets/hook"
@@ -5,6 +5,8 @@ module FigaroSecrets
5
5
  SECRET_REGEX = /^secretsmanager:(?<secret>.*)/
6
6
 
7
7
  def parse_secrets(configuration)
8
+ return configuration unless FigaroSecrets.enabled?
9
+
8
10
  configuration.inject({}) do |memo, (key, value)|
9
11
  memo.merge(key => parse_secret(key, value))
10
12
  end
@@ -1,3 +1,3 @@
1
1
  module FigaroSecrets
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -2,6 +2,14 @@ require "test_helper"
2
2
 
3
3
  class FigaroSecretsTest < Minitest::Test
4
4
  def test_that_it_has_a_version_number
5
- refute_nil ::FigaroSecrets::VERSION
5
+ refute_nil FigaroSecrets::VERSION
6
+ end
7
+
8
+ def test_enabled?
9
+ assert_equal true, FigaroSecrets.enabled?
10
+ original_env = ENV.to_h.dup
11
+ ENV["FIGARO_SECRETS"] = "false"
12
+ assert_equal false, FigaroSecrets.enabled?
13
+ ENV.replace(original_env)
6
14
  end
7
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: figaro_secrets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cory Kaufman-Schofield