ac-awssecrets 2.4.1 → 2.4.2
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.
- package/CHANGELOG.md +10 -0
- package/g.sh +11 -0
- package/index.js +14 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
<a name="2.4.2"></a>
|
|
2
|
+
|
|
3
|
+
## [2.4.2](https://github.com/admiralcloud/ac-awssecrets/compare/v2.4.1..v2.4.2) (2024-11-16 15:52:33)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fix
|
|
7
|
+
|
|
8
|
+
* **App:** Deep merge parameters | MP | [ba51f27d9f9723dcdbd4ad265ba5f359a4048456](https://github.com/admiralcloud/ac-awssecrets/commit/ba51f27d9f9723dcdbd4ad265ba5f359a4048456)
|
|
9
|
+
If merge is true, make sure to deep merge objects
|
|
10
|
+
Related issues: [undefined/undefined#master](undefined/browse/master)
|
|
1
11
|
<a name="2.4.1"></a>
|
|
2
12
|
|
|
3
13
|
## [2.4.1](https://github.com/admiralcloud/ac-awssecrets/compare/v2.4.0..v2.4.1) (2024-10-18 13:50:58)
|
package/g.sh
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
aws ssm get-parameters-by-path \
|
|
3
|
+
--path "/development" \
|
|
4
|
+
--recursive \
|
|
5
|
+
--profile dev.mfa --region eu-central-1 \
|
|
6
|
+
--output json | \
|
|
7
|
+
jq '.Parameters[] |
|
|
8
|
+
{Name: .Name}'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
{"secret":"L4w,UU3g;NAh)e6,HV(TTzUZ2G>","name":"acauth","valueHasJSON":"true","defaultApps":{"acapp":"8d09356a-042f-4d4a-9c6f-935329000969","embedlink": "5ffd8ff6-2aeb-44b0-8a6c-f413de58df3c"},"passwordAlgorithm":"aes-256-ctr","password":"8gZVqjzKN@g4XdD7Cq#9qAPh>iPdKNkr"}
|
package/index.js
CHANGED
|
@@ -31,6 +31,19 @@ const awsSecrets = () => {
|
|
|
31
31
|
: setKey(obj[head], rest.join('.'), value)
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
const deepMerge = (target, source) => {
|
|
35
|
+
const result = { ...target }
|
|
36
|
+
for (const key in source) {
|
|
37
|
+
if (typeof source[key] === 'object' && !Array.isArray(source[key]) && typeof result[key] === 'object' && !Array.isArray(result[key])) {
|
|
38
|
+
result[key] = deepMerge(result[key], source[key])
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
result[key] = source[key]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return result
|
|
45
|
+
}
|
|
46
|
+
|
|
34
47
|
const setValue = (config, { path, value, array = false, property, merge = false }) => {
|
|
35
48
|
// path can be from AWS parametes store (/a/b/c) or a real JSON path (a.b.c)
|
|
36
49
|
const keys = path.includes('/') ? path.split('/').filter(Boolean) : path.split('.')
|
|
@@ -69,7 +82,7 @@ const awsSecrets = () => {
|
|
|
69
82
|
}
|
|
70
83
|
else {
|
|
71
84
|
if (merge && typeof pointer[lastKey] === 'object' && !Array.isArray(pointer[lastKey]) && typeof value === 'object' && !Array.isArray(value)) {
|
|
72
|
-
pointer[lastKey] =
|
|
85
|
+
pointer[lastKey] = deepMerge(pointer[lastKey], value) // Use deepMerge instead of spread
|
|
73
86
|
}
|
|
74
87
|
else {
|
|
75
88
|
pointer[lastKey] = value
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "Mark Poepping (https://www.admiralcloud.com)",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "admiralcloud/ac-awssecrets",
|
|
6
|
-
"version": "2.4.
|
|
6
|
+
"version": "2.4.2",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@aws-sdk/client-secrets-manager": "^3.674.0",
|
|
9
9
|
"@aws-sdk/client-ssm": "^3.674.0"
|