@friggframework/devtools 2.0.0--canary.654.3cd4278.0 → 2.0.0--canary.654.5821f44.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.
|
@@ -49,9 +49,22 @@ function addTelemetryEnvPassthrough(appDefinition, envVars) {
|
|
|
49
49
|
// the core default, so it emits no env var.
|
|
50
50
|
function addLoggingEnv(appDefinition, envVars) {
|
|
51
51
|
const level = appDefinition?.logging?.level;
|
|
52
|
-
|
|
52
|
+
const normalized = level === undefined ? undefined : normalizeLogLevel(level);
|
|
53
|
+
|
|
54
|
+
// serverless-offline copies only AWS_* shell vars into handlers, so under
|
|
55
|
+
// frigg start the shell level must travel through provider.environment.
|
|
56
|
+
if (process.env.FRIGG_SKIP_AWS_DISCOVERY === 'true') {
|
|
57
|
+
const shellLevel = process.env.FRIGG_LOG_LEVEL?.trim();
|
|
58
|
+
if (shellLevel) {
|
|
59
|
+
envVars.FRIGG_LOG_LEVEL = shellLevel;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
// Emit INFO too: without it the local DEBUG default (IS_OFFLINE) wins.
|
|
63
|
+
if (normalized) envVars.FRIGG_LOG_LEVEL = normalized;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
53
66
|
|
|
54
|
-
|
|
67
|
+
if (normalized === undefined) return;
|
|
55
68
|
if (normalized === 'INFO') {
|
|
56
69
|
delete envVars.FRIGG_LOG_LEVEL;
|
|
57
70
|
return;
|
|
@@ -206,6 +206,64 @@ describe('Environment Builder', () => {
|
|
|
206
206
|
getAppEnvironmentVars({ logging: { level: 'verbose' } })
|
|
207
207
|
).toThrow(/logging\.level/);
|
|
208
208
|
});
|
|
209
|
+
|
|
210
|
+
describe('under frigg start (FRIGG_SKIP_AWS_DISCOVERY=true)', () => {
|
|
211
|
+
const saved = {};
|
|
212
|
+
const setEnv = (vars) => {
|
|
213
|
+
for (const [key, value] of Object.entries(vars)) {
|
|
214
|
+
saved[key] = process.env[key];
|
|
215
|
+
if (value === undefined) delete process.env[key];
|
|
216
|
+
else process.env[key] = value;
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
beforeEach(() => setEnv({ FRIGG_SKIP_AWS_DISCOVERY: 'true', FRIGG_LOG_LEVEL: undefined }));
|
|
221
|
+
|
|
222
|
+
afterEach(() => {
|
|
223
|
+
for (const [key, value] of Object.entries(saved)) {
|
|
224
|
+
if (value === undefined) delete process.env[key];
|
|
225
|
+
else process.env[key] = value;
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
it('passes the shell FRIGG_LOG_LEVEL to the handlers, which serverless-offline would drop', () => {
|
|
230
|
+
setEnv({ FRIGG_LOG_LEVEL: 'warn' });
|
|
231
|
+
|
|
232
|
+
expect(getAppEnvironmentVars({}).FRIGG_LOG_LEVEL).toBe('warn');
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it('lets the shell FRIGG_LOG_LEVEL win over logging.level', () => {
|
|
236
|
+
setEnv({ FRIGG_LOG_LEVEL: 'error' });
|
|
237
|
+
|
|
238
|
+
expect(
|
|
239
|
+
getAppEnvironmentVars({ logging: { level: 'debug' } }).FRIGG_LOG_LEVEL
|
|
240
|
+
).toBe('error');
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
it('emits logging.level INFO, so the local DEBUG default does not replace it', () => {
|
|
244
|
+
expect(
|
|
245
|
+
getAppEnvironmentVars({ logging: { level: 'info' } }).FRIGG_LOG_LEVEL
|
|
246
|
+
).toBe('INFO');
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
it('ignores an empty shell value', () => {
|
|
250
|
+
setEnv({ FRIGG_LOG_LEVEL: ' ' });
|
|
251
|
+
|
|
252
|
+
expect(getAppEnvironmentVars({})).not.toHaveProperty('FRIGG_LOG_LEVEL');
|
|
253
|
+
expect(
|
|
254
|
+
getAppEnvironmentVars({ logging: { level: 'warn' } }).FRIGG_LOG_LEVEL
|
|
255
|
+
).toBe('WARN');
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
it('does not read the shell value outside frigg start', () => {
|
|
259
|
+
setEnv({ FRIGG_SKIP_AWS_DISCOVERY: undefined, FRIGG_LOG_LEVEL: 'error' });
|
|
260
|
+
|
|
261
|
+
expect(getAppEnvironmentVars({})).not.toHaveProperty('FRIGG_LOG_LEVEL');
|
|
262
|
+
expect(
|
|
263
|
+
getAppEnvironmentVars({ logging: { level: 'info' } })
|
|
264
|
+
).not.toHaveProperty('FRIGG_LOG_LEVEL');
|
|
265
|
+
});
|
|
266
|
+
});
|
|
209
267
|
});
|
|
210
268
|
|
|
211
269
|
describe("getAppEnvironmentVars() - 'ssm' offload", () => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/devtools",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "2.0.0--canary.654.
|
|
4
|
+
"version": "2.0.0--canary.654.5821f44.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"frigg": "./frigg-cli/index.js"
|
|
7
7
|
},
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"@babel/eslint-parser": "^7.18.9",
|
|
27
27
|
"@babel/parser": "^7.25.3",
|
|
28
28
|
"@babel/traverse": "^7.25.3",
|
|
29
|
-
"@friggframework/core": "2.0.0--canary.654.
|
|
30
|
-
"@friggframework/schemas": "2.0.0--canary.654.
|
|
31
|
-
"@friggframework/test": "2.0.0--canary.654.
|
|
29
|
+
"@friggframework/core": "2.0.0--canary.654.5821f44.0",
|
|
30
|
+
"@friggframework/schemas": "2.0.0--canary.654.5821f44.0",
|
|
31
|
+
"@friggframework/test": "2.0.0--canary.654.5821f44.0",
|
|
32
32
|
"@hapi/boom": "^10.0.1",
|
|
33
33
|
"@inquirer/prompts": "^5.3.8",
|
|
34
34
|
"axios": "^1.18.0",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"validate-npm-package-name": "^5.0.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@friggframework/eslint-config": "2.0.0--canary.654.
|
|
60
|
-
"@friggframework/prettier-config": "2.0.0--canary.654.
|
|
59
|
+
"@friggframework/eslint-config": "2.0.0--canary.654.5821f44.0",
|
|
60
|
+
"@friggframework/prettier-config": "2.0.0--canary.654.5821f44.0",
|
|
61
61
|
"aws-sdk-client-mock": "^4.1.0",
|
|
62
62
|
"aws-sdk-client-mock-jest": "^4.1.0",
|
|
63
63
|
"jest": "^30.1.3",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"publishConfig": {
|
|
90
90
|
"access": "public"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "5821f44da7972564eb82727042b9760556114670"
|
|
93
93
|
}
|