rails-creds 0.2.3 → 0.3.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: 180c1ca9192de8e7d152b8287d51031006f724e76e35620c7c19111c97cca536
4
- data.tar.gz: dc4cb85e4083a01a2b825b5568cc56e0391d932e3c9683c466c55f72d676656b
3
+ metadata.gz: a713e64a2dc6c6e291bb0973929f4cb44441eb59c0d359870e0b932e5d4fcc3c
4
+ data.tar.gz: 483da513f4671cde3fc1e2cf83a2b04b5bc456e3fbc564079afd2085002da33b
5
5
  SHA512:
6
- metadata.gz: 56cd8bd00245b4e15d5a9b145e420e8f330a7d76a5db58a38d9580d97b4cdf3319ce10ddc52c6b7de1a4611e20c2a69a836978c21e1af988e50025548ee7f8e1
7
- data.tar.gz: d017e6fbaf58ae2844a91bd820930054696b2b438ec995ff7fc37a1cad8b5f2983fcde085662afa8e15d489552fd0f81b1e989ffc921429c080c4d79122a022a
6
+ metadata.gz: 12c4b010d5370eaabfbafcac7c02b2bb9173b2a0e106f76523719f6c5c6fe8273b2ead284fe85ca767ff789c62e844d0f12cbc9679a05823c1343fa1c5a5fbf3
7
+ data.tar.gz: f3446191d7149a213fcff4277b78354a652a41166743ea341e4191bfe79e5a1bed73a5ee83bcfed8162252c5b8d204ef025a6f400d7656f5ba42bf41aa0f39f3
data/CHANGELOG.md CHANGED
@@ -1,24 +1,30 @@
1
- # 0.2.3 (2019-08-19)
1
+ ## 0.3.0 (2019-09-19)
2
2
 
3
- Fixed:
3
+ ### Breaking changes
4
+
5
+ - _(Possibly breaking)_ Scoped creds are now merged with top level creds ([#23](https://github.com/mikker/rails-creds/pull/23))
6
+
7
+ ## 0.2.3 (2019-08-19)
8
+
9
+ ### Fixed:
4
10
 
5
11
  - Require strip_heredoc extension before use
6
12
 
7
- # 0.2.1
13
+ ## 0.2.1
8
14
 
9
- Changed:
15
+ ## Changed:
10
16
 
11
17
  - Credentials are now memoized after successful read.
12
18
 
13
- # 0.2.0
19
+ ## 0.2.0
14
20
 
15
- Changed:
21
+ ### Changed:
16
22
 
17
23
  - Creds will now warn about missing credentials when the encrypted file isn't
18
24
  found. It will afterwards be a Null Object and return `nil` on every key.
19
25
  - When encrypted credentials are found but the master key file AND env
20
26
  variable is missing, Creds will return a special error with explanation.
21
27
 
22
- # 0.1.0
28
+ ## 0.1.0
23
29
 
24
30
  Initial version
data/README.md CHANGED
@@ -10,17 +10,9 @@ Given encrypted credentials looking like:
10
10
 
11
11
  ```yaml
12
12
  ---
13
- default: &default
14
- super_secret: 'shared between environments'
15
-
16
- development:
17
- <<: *default
18
-
19
- test:
20
- <<: *default
13
+ super_secret: 'shared between environments'
21
14
 
22
15
  production:
23
- <<: *default
24
16
  super_secret: 'you can override defaults for individual environments'
25
17
  ```
26
18
 
data/creds.gemspec CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_dependency "rails", "> 5.2"
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 2.0"
27
- spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "rake", "~> 12.3"
28
28
  spec.add_development_dependency "rspec", "~> 3.0"
29
29
  spec.add_development_dependency "standard", "~> 0.1.0"
30
- end
30
+ end
data/lib/creds.rb CHANGED
@@ -58,7 +58,10 @@ class Creds
58
58
  private
59
59
 
60
60
  def fetch_credentials_for_current_env
61
- Rails.application.credentials.fetch(Rails.env.to_sym)
61
+ base = Rails.application.credentials.config
62
+ scoped = base.fetch(Rails.env.to_sym)
63
+ base.delete(Rails.env.to_sym)
64
+ base.merge(scoped)
62
65
  rescue KeyError
63
66
  raise MissingEnvError, Rails.env
64
67
  end
@@ -70,6 +73,7 @@ class Creds
70
73
  def master_key_present?
71
74
  return true if ENV["RAILS_MASTER_KEY"]
72
75
  return true if File.exist?(Rails.root.join("config", "master.key"))
76
+
73
77
  false
74
78
  end
75
79
  end
data/lib/creds/errors.rb CHANGED
@@ -32,14 +32,7 @@ class Creds
32
32
  Here's an example of how your credentials could look:
33
33
 
34
34
  ---
35
- default: &default
36
- aws_key: 'shared between environments'
37
-
38
- development:
39
- <<: *default
40
-
41
- test:
42
- <<: *default
35
+ aws_key: 'shared between environments'
43
36
 
44
37
  production:
45
38
  <<: *default
data/lib/creds/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Creds
2
- VERSION = "0.2.3".freeze
2
+ VERSION = "0.3.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-creds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikkel Malmberg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-19 00:00:00.000000000 Z
11
+ date: 2019-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '12.3'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '12.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  requirements: []
125
- rubygems_version: 3.0.4
125
+ rubygems_version: 3.0.3
126
126
  signing_key:
127
127
  specification_version: 4
128
128
  summary: Shorter, env-scoped version of Rails' credentials