dry-credentials 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d4a73f1a9d55f7e32296e39d78e7ff5a6273226c25d10e97b0d2a10b9a00f1c
4
- data.tar.gz: 56f39f76baf2a18dbc4bf163d5d12697687a2a026fcc9d01f6b632fef7dcf633
3
+ metadata.gz: a87f2e29c53fafba34356002ee07e2eb2d31fba25135d51b9098b34171a771cb
4
+ data.tar.gz: d675791b951d5220f8dafc35330deb022eea62cd2bc82f7e84963d9504441763
5
5
  SHA512:
6
- metadata.gz: caac2559ad90fadce9f4b56923d556687d8da8c54eaf16de502e5c2598c10fbb49c57ef5acf8bbe7aaf87434e17bf66d816b25a2cd282ab920b1da5e45b25a21
7
- data.tar.gz: a443919baad7138e75beedb23709a45526a986be9225ff6f4f3456cde71c41d03b220de32c6e27ab489839f35d5e467b54a9531f075c1cea80b41f4d64a25dd1
6
+ metadata.gz: 0a13c705e06e11791408562219391cf524d7e1d17069cfcfd1d9469cb41187bf7649be21df8b230435c487621b90a2d86f05b19d54bb52dab7a09f215a042b25
7
+ data.tar.gz: 0c07cae029dc55ba469e469a4f250f36ae73064ec8d5529b6a9f6f9239757eb1ce95ceae7471bb6d959c60e2419fd559de3a6169204bf99c2d15bae726431c43
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -2,16 +2,24 @@
2
2
 
3
3
  Nothing so far
4
4
 
5
+ ## 0.3.0
6
+
7
+ #### Additions
8
+
9
+ * Support generic fallback environment variable +CREDENTIALS_KEY+
10
+
5
11
  ## 0.2.1
6
12
 
7
13
  ## 0.2.1
8
14
 
15
+ #### Additions
16
+
9
17
  * Add square brackets setter for settings
10
18
  * Explain integrations for Bridgetown, Hanami 2 and Rodbot
11
19
 
12
20
  ## 0.2.0
13
21
 
14
- #### Breaking Changes
22
+ #### Breaking changes
15
23
 
16
24
  * Fall back to `APP_ENV` instead of `RACK_ENV`
17
25
 
@@ -21,7 +29,7 @@ Nothing so far
21
29
 
22
30
  ## 0.1.0
23
31
 
24
- #### Initial Implementation
32
+ #### Initial implementation
25
33
 
26
34
  * Require Ruby 3.0 or newer
27
35
  * Class mixin featuring the `credentials` macro:
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  [![Version](https://img.shields.io/gem/v/dry-credentials.svg?style=flat)](https://rubygems.org/gems/dry-credentials)
2
2
  [![Tests](https://img.shields.io/github/actions/workflow/status/svoop/dry-credentials/test.yml?style=flat&label=tests)](https://github.com/svoop/dry-credentials/actions?workflow=Test)
3
3
  [![Code Climate](https://img.shields.io/codeclimate/maintainability/svoop/dry-credentials.svg?style=flat)](https://codeclimate.com/github/svoop/dry-credentials/)
4
- [![Donorbox](https://img.shields.io/badge/donate-on_donorbox-yellow.svg)](https://donorbox.org/bitcetera)
4
+ [![GitHub Sponsors](https://img.shields.io/github/sponsors/svoop.svg)](https://github.com/sponsors/svoop)
5
5
 
6
6
  # Dry::Credentials
7
7
 
@@ -13,6 +13,8 @@ While similar in purpose to ActiveSupport::EncryptedConfiguration, this lightwei
13
13
  * [API](https://www.rubydoc.info/gems/dry-credentials)
14
14
  * Author: [Sven Schwyn - Bitcetera](https://bitcetera.com)
15
15
 
16
+ Thank you for supporting free and open-source software by sponsoring on [GitHub](https://github.com/sponsors/svoop) or on [Donorbox](https://donorbox.com/bitcetera). Any gesture is appreciated, from a single Euro for a ☕️ cup of coffee to 🍹 early retirement.
17
+
16
18
  ## Install
17
19
 
18
20
  ### Security
@@ -96,6 +98,12 @@ To decrypt the credentials and use them in your app, you have to set just this o
96
98
  export SANDBOX_CREDENTIALS_KEY=68656973716a4e706e336733377245732b6e77584c6c772b5432446532456f674767664271374a623876383d
97
99
  ```
98
100
 
101
+ Alternatively, you can omit the first part of the variable name. Such a key will be used for any app environment, but a more specific key will always take precedence. This is particularly useful when working with containerized setups:
102
+
103
+ ```sh
104
+ export CREDENTIALS_KEY=68656973716a4e706e336733377245732b6e77584c6c772b5432446532456f674767664271374a623876383d
105
+ ```
106
+
99
107
  With this in place, you can use the decrypted credentials anywhere in your app:
100
108
 
101
109
  ```ruby
@@ -164,7 +172,7 @@ The [bridgetown_credentials gem](https://github.com/svoop/bridgetown_credentials
164
172
 
165
173
  ### Hanami 2
166
174
 
167
- To use credentials in a [Hanami 2](https//hanami.org) app, first add this gem to the gemfile of the app and then create a provider `config/providers/credentials.rb`:
175
+ To use credentials in a [Hanami 2](https//hanami.org) app, first add this gem to the Gemfile of the app and then create a provider `config/providers/credentials.rb`:
168
176
 
169
177
  ```ruby
170
178
  # frozen_string_literal: true
@@ -175,6 +183,8 @@ Hanami.app.register_provider :credentials do
175
183
 
176
184
  Dry::Credentials::Extension.new.then do |credentials|
177
185
  credentials[:env] = Hanami.env
186
+ credentials[:dir] = Hanami.app.root.join(credentials[:dir])
187
+ credentials[:dir].mkpath
178
188
  credentials.load!
179
189
  register "credentials", credentials
180
190
  end
@@ -182,7 +192,7 @@ Hanami.app.register_provider :credentials do
182
192
  end
183
193
  ```
184
194
 
185
- You might want to add a Rake task `lib/tasks/credentials.rake` as well:
195
+ Next up are Rake tasks `lib/tasks/credentials.rake`:
186
196
 
187
197
  ```ruby
188
198
  namespace :credentials do
@@ -75,7 +75,7 @@ module Dry
75
75
  if create?
76
76
  ENV[key_ev] = encryptor.generate_key
77
77
  else
78
- ENV[key_ev] or fail Dry::Credentials::KeyNotSetError
78
+ (ENV[key_ev] || ENV['CREDENTIALS_KEY']) or fail Dry::Credentials::KeyNotSetError
79
79
  end
80
80
  end
81
81
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Credentials
5
- VERSION = "0.2.1"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-credentials
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Schwyn
@@ -10,24 +10,26 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIC+jCCAeKgAwIBAgIBAjANBgkqhkiG9w0BAQsFADAjMSEwHwYDVQQDDBhydWJ5
14
- L0RDPWJpdGNldGVyYS9EQz1jb20wHhcNMjMxMTEwMTgyMzM2WhcNMjQxMTA5MTgy
15
- MzM2WjAjMSEwHwYDVQQDDBhydWJ5L0RDPWJpdGNldGVyYS9EQz1jb20wggEiMA0G
13
+ MIIDODCCAiCgAwIBAgIBATANBgkqhkiG9w0BAQsFADAjMSEwHwYDVQQDDBhydWJ5
14
+ L0RDPWJpdGNldGVyYS9EQz1jb20wHhcNMjQxMTIwMjExMDIwWhcNMjUxMTIwMjEx
15
+ MDIwWjAjMSEwHwYDVQQDDBhydWJ5L0RDPWJpdGNldGVyYS9EQz1jb20wggEiMA0G
16
16
  CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDcLg+IHjXYaUlTSU7R235lQKD8ZhEe
17
17
  KMhoGlSUonZ/zo1OT3KXcqTCP1iMX743xYs6upEGALCWWwq+nxvlDdnWRjF3AAv7
18
18
  ikC+Z2BEowjyeCCT/0gvn4ohKcR0JOzzRaIlFUVInlGSAHx2QHZ2N8ntf54lu7nd
19
19
  L8CiDK8rClsY4JBNGOgH9UC81f+m61UUQuTLxyM2CXfAYkj/sGNTvFRJcNX+nfdC
20
20
  hM9r2kH1+7wsa8yG7wJ2IkrzNACD8v84oE6qVusN8OLEMUI/NaEPVPbw2LUM149H
21
21
  PVa0i729A4IhroNnFNmw4wOC93ARNbM1+LW36PLMmKjKudf5Exg8VmDVAgMBAAGj
22
- OTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBSfK8MtR62mQ6oN
23
- yoX/VKJzFjLSVDANBgkqhkiG9w0BAQsFAAOCAQEAXhT/LpMArF3JRcZSRkJDY+dU
24
- GKCRqOefi2iydqh1yIqXyTA9PGR1w5O6O+WS1FvF+sHCwh8fFjCuStg2L8V2RSeo
25
- aDtfZ5s80sL8wRFxg3kek69cBuI6ozU+rf9DaXlMES4i8+zASsdv9Y4a2BsbhEdE
26
- 9AtuMcWn5a45TOO0S4Q8OuV0v705V38Ow15J2RDRvkFRySt+//8/Vd57XAJxPXU0
27
- k/QvZU05f6HMYBrPogJgIzHC/C5N/yeE4BVEuBDn+10Zb1iu3aDk8sd0uMgukCY8
28
- TUmlP5A6NeGdeDJIoLgromAKs+nvI7TWzhQq9ODs51XhxgUFRCvBqUTpjTQigw==
22
+ dzB1MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBSfK8MtR62mQ6oN
23
+ yoX/VKJzFjLSVDAdBgNVHREEFjAUgRJydWJ5QGJpdGNldGVyYS5jb20wHQYDVR0S
24
+ BBYwFIEScnVieUBiaXRjZXRlcmEuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQDSeB1x
25
+ 8QK8F/ML37isgvwGiQxovDUqu6Sq14cQ1qE9y5prUBmL2AsDuCBpXXctcvamFqNC
26
+ PgfJtj7ZZcXmY0SfKCog7T1btkr6zYxPXpxwUqB45n0I6v5qc0UCNvMEfBzxlak5
27
+ VW7UMNlKD9qukeN55hxuLF2F/sLldMcHUo/ATgdV4zk1t3sK6A9+02wz5K5qfWdM
28
+ Mi+XWXmGd57uojk3RcIXNwBRRP4DTKcKgVXhuyHb7q1vjTXrS6bw1Ortu0KmWOIk
29
+ jTyRsT1gymASS2KHe+BaCTwD74GqO8q4woYLZgXnJ/PvgcFgY2FEi2Kn/sXLp4JE
30
+ boIgxQCMT+nxBHCD
29
31
  -----END CERTIFICATE-----
30
- date: 2024-03-06 00:00:00.000000000 Z
32
+ date: 2024-12-08 00:00:00.000000000 Z
31
33
  dependencies:
32
34
  - !ruby/object:Gem::Dependency
33
35
  name: base64
@@ -85,6 +87,20 @@ dependencies:
85
87
  - - ">="
86
88
  - !ruby/object:Gem::Version
87
89
  version: '0'
90
+ - !ruby/object:Gem::Dependency
91
+ name: minitest-substitute
92
+ requirement: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ type: :development
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
88
104
  - !ruby/object:Gem::Dependency
89
105
  name: minitest-flash
90
106
  requirement: !ruby/object:Gem::Requirement
@@ -215,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
231
  - !ruby/object:Gem::Version
216
232
  version: '0'
217
233
  requirements: []
218
- rubygems_version: 3.5.6
234
+ rubygems_version: 3.5.23
219
235
  signing_key:
220
236
  specification_version: 4
221
237
  summary: A mixin to use encrypted credentials in your classes
metadata.gz.sig CHANGED
Binary file