ssm_params_loader 0.0.1 → 0.0.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5ebdf049efcb5bb6b26c4c05f7530592a477047f5aec5f5f90b2d1352cf3b5f
|
4
|
+
data.tar.gz: d468f77006bcba68a1ad413eb7ac333ffc254af39008e04ab28d247c4dde8ab2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec4fdd361fc040466d20106c3b2d5b5e7751ea0f2a616b06c7d0f518fc66d42780c33d41514a587424ae126d930ed7d81d96a29b1cc6f229957ec01581d2d791
|
7
|
+
data.tar.gz: 1257e44df91a296521cbedbeaacd3478f26117806930852bfeb58553ab5e8ff6fa1b712fbdd46286f1c1296dfdd6e077a8ed70cf0f2437028ed981831cf086a4
|
@@ -1,5 +1,9 @@
|
|
1
1
|
# Path to a SSM parameters
|
2
|
-
|
2
|
+
# The lower the position in the list, the higher the priority
|
3
|
+
# of two parameters with the same name, the one received last will be used
|
4
|
+
ssm_store_paths: [ ]
|
5
|
+
# - /Shared/production
|
6
|
+
# - /MyApp/production
|
3
7
|
|
4
8
|
# Additional static secrets list
|
5
9
|
# If a name is equal to a name obtained from the SSM, the value from the SSM
|
@@ -12,11 +12,11 @@ module SsmParamsLoader
|
|
12
12
|
|
13
13
|
config = YAML.safe_load_file(config_file).with_indifferent_access
|
14
14
|
|
15
|
-
|
15
|
+
ssm_paths = config[:ssm_store_paths] || nil
|
16
16
|
additional = config[:additional_vars] || nil
|
17
17
|
|
18
18
|
# Get secrets and set environment variables
|
19
|
-
environments = load_secrets(
|
19
|
+
environments = load_secrets(ssm_paths, additional)
|
20
20
|
environments.each { |secret| ENV["SSM_#{secret[:name].gsub('-', '_').upcase}"] = secret[:value] }
|
21
21
|
end
|
22
22
|
|
@@ -28,11 +28,14 @@ module SsmParamsLoader
|
|
28
28
|
end
|
29
29
|
|
30
30
|
# Get a hash array of secrets
|
31
|
-
def self.load_secrets(
|
31
|
+
def self.load_secrets(ssm_paths, additional)
|
32
32
|
secrets = []
|
33
33
|
|
34
|
-
unless
|
35
|
-
|
34
|
+
unless ssm_paths.nil?
|
35
|
+
ssm_paths.each do |path|
|
36
|
+
puts path
|
37
|
+
secrets += from_ssm(path)
|
38
|
+
end
|
36
39
|
end
|
37
40
|
|
38
41
|
unless additional.nil?
|