secrets_manager 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/secrets_manager/railtie.rb +9 -2
- data/lib/secrets_manager/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6f78bf44f4a693f45c3f0bb3866fffe8993818670c8bc11fc75576075a62765
|
4
|
+
data.tar.gz: 961c7ae680195646c3c7881907b2359ac973ff5a016349cc8752ec0f4e87f151
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f61ee3edfe91765bdedd24668360b7a92bd427e86fd01e0dc1fc1ecfef7ad5aefff4334ca7338368addc850b68f683ab64bfcd0714840185342730d59f28a2a
|
7
|
+
data.tar.gz: 32f9a9da03bb54473a3e761dcdaf2a2b728f866dd00e068f44e3f957cbc3a92136d80dee43272a80b17337b63eb3800d7e15ca11cb62a84fef7663d7458f0d3d
|
@@ -1,9 +1,12 @@
|
|
1
1
|
require 'secrets_manager/config'
|
2
2
|
require 'secrets_manager/client'
|
3
|
+
require 'secrets_manager/helpers'
|
3
4
|
|
4
5
|
module SecretsManager
|
5
6
|
class Railtie < ::Rails::Railtie
|
6
7
|
config.before_configuration do
|
8
|
+
include SecretsManager::Helpers
|
9
|
+
|
7
10
|
unless File.file?(Rails.root.join('config', 'application.yml'))
|
8
11
|
puts 'Initializing secrets via Secrets Manager gem.'
|
9
12
|
|
@@ -16,8 +19,12 @@ module SecretsManager
|
|
16
19
|
secrets_config.secrets.each do |secret|
|
17
20
|
next if File.file?(Rails.root.join(secret.path))
|
18
21
|
|
19
|
-
|
20
|
-
|
22
|
+
if secret.plaintext? && secret.to_file?
|
23
|
+
write_to_file(aws_client.get_secret_string(secret.id), secret.path)
|
24
|
+
else
|
25
|
+
aws_client.get_secret_hash(secret.id).each do |key, value|
|
26
|
+
ENV[key.to_s] = value
|
27
|
+
end
|
21
28
|
end
|
22
29
|
end
|
23
30
|
end
|