@jaypie/constructs 1.2.60 → 1.2.61

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.
@@ -2,6 +2,7 @@ export interface JaypieLambdaEnvOptions {
2
2
  initialEnvironment?: {
3
3
  [key: string]: string;
4
4
  };
5
+ serviceTag?: string;
5
6
  }
6
7
  export declare function jaypieLambdaEnv(options?: JaypieLambdaEnvOptions): {
7
8
  [key: string]: string;
package/dist/esm/index.js CHANGED
@@ -702,7 +702,7 @@ function isValidSubdomain(subdomain) {
702
702
  }
703
703
 
704
704
  function jaypieLambdaEnv(options = {}) {
705
- const { initialEnvironment = {} } = options;
705
+ const { initialEnvironment = {}, serviceTag } = options;
706
706
  // Start with empty environment - we'll only add valid values
707
707
  let environment = {};
708
708
  // First, add all valid string values from initialEnvironment
@@ -731,6 +731,11 @@ function jaypieLambdaEnv(options = {}) {
731
731
  environment[key] = defaultValue;
732
732
  }
733
733
  });
734
+ // Apply serviceTag as PROJECT_SERVICE unless explicitly overridden.
735
+ // Precedence: explicit environment > serviceTag > process.env.PROJECT_SERVICE
736
+ if (serviceTag && !environment.PROJECT_SERVICE) {
737
+ environment.PROJECT_SERVICE = serviceTag;
738
+ }
734
739
  // Default environment variables from process.env if present
735
740
  const defaultEnvVars = [
736
741
  "DATADOG_API_KEY_ARN",
@@ -1602,7 +1607,7 @@ class JaypieLambda extends Construct {
1602
1607
  // Resolve environment from array or object syntax
1603
1608
  const initialEnvironment = resolveEnvironment(environmentInput);
1604
1609
  // Get base environment with defaults
1605
- const environment = jaypieLambdaEnv({ initialEnvironment });
1610
+ const environment = jaypieLambdaEnv({ initialEnvironment, serviceTag });
1606
1611
  // Resolve secrets from mixed array (strings and JaypieSecret instances)
1607
1612
  // Use Stack.of(this) to ensure secrets are shared at stack level across all constructs
1608
1613
  const secrets = resolveSecrets(Stack.of(this), secretsInput);