dry-credentials 0.5.1 → 0.6.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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +7 -0
- data/lib/dry/credentials/helpers.rb +7 -2
- data/lib/dry/credentials/version.rb +1 -1
- metadata +1 -15
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 75fffe7657df51c4024515b19bc9844f19ab914885e9fa7bfc88eecd777a6562
|
|
4
|
+
data.tar.gz: 99d82a79fa22559765e2ec7673038a153771739fe95fe564dded76f689c4ae36
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 95cf92beaa0f57b58c537ca34f50996d0a13fdbc263b4ce242e1bbdf125d80eb0e6c6458f02769bd2cebea4f53fcdbe0ca0c50d0fff000cece2c5921509b5c12
|
|
7
|
+
data.tar.gz: 5ab85de6a1c56572e9c228c29201387e78890948af7ab8c312726659e6687c32315df2b010677e84c0b23b1f4b289be0e00f495eac99cbeb0cfe5a6c0e7a944b
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -94,6 +94,13 @@ Alternatively, you can omit the first part of the variable name. Such a key will
|
|
|
94
94
|
export CREDENTIALS_KEY=68656973716a4e706e336733377245732b6e77584c6c772b5432446532456f674767664271374a623876383d
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
+
You can also read keys from files which is the recommended way when using [secrets in Docker Compose](https://docs.docker.com/compose/how-tos/use-secrets/). Just append `_FILE` to the corresponding environment variable name and set it to the path from which the secret can be read, for example:
|
|
98
|
+
|
|
99
|
+
```db
|
|
100
|
+
export SANDBOX_CREDENTIALS_KEY_FILE=/run/secrets/sandbox_credentials_key
|
|
101
|
+
export CREDENTIALS_KEY_FILE=/run/secrets/credentials_key
|
|
102
|
+
```
|
|
103
|
+
|
|
97
104
|
With this in place, you can use the decrypted credentials anywhere in your app:
|
|
98
105
|
|
|
99
106
|
```ruby
|
|
@@ -72,10 +72,15 @@ module Dry
|
|
|
72
72
|
private
|
|
73
73
|
|
|
74
74
|
def key
|
|
75
|
-
|
|
75
|
+
case
|
|
76
|
+
when create?
|
|
76
77
|
ENV[key_ev] = encryptor.generate_key
|
|
78
|
+
when key = ENV[key_ev] || ENV['CREDENTIALS_KEY']
|
|
79
|
+
key
|
|
80
|
+
when file = ENV["#{key_ev}_FILE"] || ENV['CREDENTIALS_KEY_FILE']
|
|
81
|
+
File.read(file)
|
|
77
82
|
else
|
|
78
|
-
|
|
83
|
+
fail Dry::Credentials::KeyNotSetError
|
|
79
84
|
end
|
|
80
85
|
end
|
|
81
86
|
|
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.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sven Schwyn
|
|
@@ -93,20 +93,6 @@ dependencies:
|
|
|
93
93
|
- - ">="
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
95
|
version: '0'
|
|
96
|
-
- !ruby/object:Gem::Dependency
|
|
97
|
-
name: minitest-focus
|
|
98
|
-
requirement: !ruby/object:Gem::Requirement
|
|
99
|
-
requirements:
|
|
100
|
-
- - ">="
|
|
101
|
-
- !ruby/object:Gem::Version
|
|
102
|
-
version: '0'
|
|
103
|
-
type: :development
|
|
104
|
-
prerelease: false
|
|
105
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
106
|
-
requirements:
|
|
107
|
-
- - ">="
|
|
108
|
-
- !ruby/object:Gem::Version
|
|
109
|
-
version: '0'
|
|
110
96
|
- !ruby/object:Gem::Dependency
|
|
111
97
|
name: guard
|
|
112
98
|
requirement: !ruby/object:Gem::Requirement
|