@jaypie/constructs 1.1.33 → 1.1.34

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/dist/esm/index.js CHANGED
@@ -292,6 +292,29 @@ class JaypieLambda extends Construct {
292
292
  const { code, datadogApiKeyArn, environment: initialEnvironment = {}, envSecrets = {}, handler = "index.handler", layers = [], logRetention = CDK$2.LAMBDA.LOG_RETENTION, memorySize = CDK$2.LAMBDA.MEMORY_SIZE, paramsAndSecrets, paramsAndSecretsOptions, provisionedConcurrentExecutions, reservedConcurrentExecutions, roleTag = CDK$2.ROLE.PROCESSING, runtime = lambda.Runtime.NODEJS_22_X, secrets = [], timeout = Duration.seconds(CDK$2.DURATION.LAMBDA_WORKER), vendorTag, } = props;
293
293
  // Create a mutable copy of the environment variables
294
294
  let environment = { ...initialEnvironment };
295
+ // Default environment values
296
+ const defaultEnvValues = {
297
+ AWS_LAMBDA_NODEJS_DISABLE_CALLBACK_WARNING: "true",
298
+ };
299
+ // Apply default environment values with user overrides
300
+ Object.entries(defaultEnvValues).forEach(([key, defaultValue]) => {
301
+ if (key in initialEnvironment) {
302
+ const userValue = initialEnvironment[key];
303
+ // If user passes a string, use that value
304
+ if (typeof userValue === "string") {
305
+ environment[key] = userValue;
306
+ }
307
+ // If user passes non-string falsy value, omit the key
308
+ else if (!userValue) {
309
+ delete environment[key];
310
+ }
311
+ // Ignore non-string truthy values (key already not present)
312
+ }
313
+ else {
314
+ // No user override, use default value
315
+ environment[key] = defaultValue;
316
+ }
317
+ });
295
318
  // Default environment variables from process.env if present
296
319
  const defaultEnvVars = [
297
320
  "DATADOG_API_KEY_ARN",