@fjall/components-infrastructure 13.1.0 → 14.0.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.
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
* calls use a retry loop with exponential backoff.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
const EXTENSION_PORT =
|
|
23
|
+
const EXTENSION_PORT =
|
|
24
|
+
process.env.PARAMETERS_SECRETS_EXTENSION_HTTP_PORT || "2773";
|
|
24
25
|
const EXTENSION_URL = `http://localhost:${EXTENSION_PORT}`;
|
|
25
26
|
const MAX_RETRIES = 5;
|
|
26
27
|
const INITIAL_DELAY_MS = 100;
|
|
@@ -41,9 +42,9 @@ async function fetchWithRetry(path) {
|
|
|
41
42
|
try {
|
|
42
43
|
const response = await fetch(`${EXTENSION_URL}${path}`, {
|
|
43
44
|
headers: {
|
|
44
|
-
"X-Aws-Parameters-Secrets-Token": process.env.AWS_SESSION_TOKEN
|
|
45
|
+
"X-Aws-Parameters-Secrets-Token": process.env.AWS_SESSION_TOKEN
|
|
45
46
|
},
|
|
46
|
-
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
47
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
47
48
|
});
|
|
48
49
|
if (response.ok) {
|
|
49
50
|
return await response.json();
|
|
@@ -73,7 +74,7 @@ async function fetchWithRetry(path) {
|
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
throw new Error(
|
|
76
|
-
`Failed to reach Extension after ${MAX_RETRIES} attempts: ${lastError?.message}
|
|
77
|
+
`Failed to reach Extension after ${MAX_RETRIES} attempts: ${lastError?.message}`
|
|
77
78
|
);
|
|
78
79
|
}
|
|
79
80
|
|
|
@@ -93,7 +94,7 @@ function assertValidEnvName(name, source) {
|
|
|
93
94
|
if (!VALID_ENV_NAME.test(name)) {
|
|
94
95
|
process.stderr.write(
|
|
95
96
|
`[fjall-resolver] Invalid env var name '${name}' from ${source}. ` +
|
|
96
|
-
`Names must match [a-zA-Z_][a-zA-Z0-9_]* (no dots or hyphens).\n
|
|
97
|
+
`Names must match [a-zA-Z_][a-zA-Z0-9_]* (no dots or hyphens).\n`
|
|
97
98
|
);
|
|
98
99
|
process.exit(1);
|
|
99
100
|
}
|
|
@@ -119,7 +120,7 @@ async function resolveSsmSecrets() {
|
|
|
119
120
|
|
|
120
121
|
try {
|
|
121
122
|
const data = await fetchWithRetry(
|
|
122
|
-
`/systemsmanager/parameters/get?name=${encodedPath}&withDecryption=true
|
|
123
|
+
`/systemsmanager/parameters/get?name=${encodedPath}&withDecryption=true`
|
|
123
124
|
);
|
|
124
125
|
const value = data?.Parameter?.Value;
|
|
125
126
|
if (value !== undefined && value !== null) {
|
|
@@ -128,7 +129,7 @@ async function resolveSsmSecrets() {
|
|
|
128
129
|
} catch (err) {
|
|
129
130
|
const msg = err instanceof Error ? err.message : String(err);
|
|
130
131
|
process.stderr.write(
|
|
131
|
-
`[fjall-resolver] Failed to resolve SSM parameter ${paramPath}: ${msg}\n
|
|
132
|
+
`[fjall-resolver] Failed to resolve SSM parameter ${paramPath}: ${msg}\n`
|
|
132
133
|
);
|
|
133
134
|
process.exit(1);
|
|
134
135
|
}
|
|
@@ -157,7 +158,7 @@ async function resolveSecretsManagerSecrets() {
|
|
|
157
158
|
|
|
158
159
|
try {
|
|
159
160
|
const data = await fetchWithRetry(
|
|
160
|
-
`/secretsmanager/get?secretId=${encodedArn}
|
|
161
|
+
`/secretsmanager/get?secretId=${encodedArn}`
|
|
161
162
|
);
|
|
162
163
|
|
|
163
164
|
let value;
|
|
@@ -167,13 +168,13 @@ async function resolveSecretsManagerSecrets() {
|
|
|
167
168
|
parsed = JSON.parse(data.SecretString);
|
|
168
169
|
} catch {
|
|
169
170
|
throw new Error(
|
|
170
|
-
`Secret is not valid JSON but field '${field}' was requested. Store the secret as a JSON object
|
|
171
|
+
`Secret is not valid JSON but field '${field}' was requested. Store the secret as a JSON object.`
|
|
171
172
|
);
|
|
172
173
|
}
|
|
173
174
|
value = parsed[field];
|
|
174
175
|
if (value === undefined) {
|
|
175
176
|
throw new Error(
|
|
176
|
-
`Field '${field}' not found in secret (${Object.keys(parsed).length} fields present)
|
|
177
|
+
`Field '${field}' not found in secret (${Object.keys(parsed).length} fields present).`
|
|
177
178
|
);
|
|
178
179
|
}
|
|
179
180
|
} else {
|
|
@@ -186,7 +187,7 @@ async function resolveSecretsManagerSecrets() {
|
|
|
186
187
|
} catch (err) {
|
|
187
188
|
const msg = err instanceof Error ? err.message : String(err);
|
|
188
189
|
process.stderr.write(
|
|
189
|
-
`[fjall-resolver] Failed to resolve SM secret ${prefix} (${arn}): ${msg}\n
|
|
190
|
+
`[fjall-resolver] Failed to resolve SM secret ${prefix} (${arn}): ${msg}\n`
|
|
190
191
|
);
|
|
191
192
|
process.exit(1);
|
|
192
193
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fjall/components-infrastructure",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/fjall-tech/fjall.git",
|
|
@@ -80,8 +80,8 @@
|
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"@aws-sdk/client-organizations": "^3.1098.0",
|
|
83
|
-
"@fjall/generator": "^
|
|
84
|
-
"@fjall/util": "^
|
|
83
|
+
"@fjall/generator": "^14.0.0",
|
|
84
|
+
"@fjall/util": "^14.0.0",
|
|
85
85
|
"constructs": "^10.7.2"
|
|
86
86
|
},
|
|
87
87
|
"overrides": {
|