@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;
@@ -738,7 +738,7 @@ function isValidSubdomain(subdomain) {
738
738
  }
739
739
 
740
740
  function jaypieLambdaEnv(options = {}) {
741
- const { initialEnvironment = {} } = options;
741
+ const { initialEnvironment = {}, serviceTag } = options;
742
742
  // Start with empty environment - we'll only add valid values
743
743
  let environment = {};
744
744
  // First, add all valid string values from initialEnvironment
@@ -767,6 +767,11 @@ function jaypieLambdaEnv(options = {}) {
767
767
  environment[key] = defaultValue;
768
768
  }
769
769
  });
770
+ // Apply serviceTag as PROJECT_SERVICE unless explicitly overridden.
771
+ // Precedence: explicit environment > serviceTag > process.env.PROJECT_SERVICE
772
+ if (serviceTag && !environment.PROJECT_SERVICE) {
773
+ environment.PROJECT_SERVICE = serviceTag;
774
+ }
770
775
  // Default environment variables from process.env if present
771
776
  const defaultEnvVars = [
772
777
  "DATADOG_API_KEY_ARN",
@@ -1638,7 +1643,7 @@ class JaypieLambda extends constructs.Construct {
1638
1643
  // Resolve environment from array or object syntax
1639
1644
  const initialEnvironment = resolveEnvironment(environmentInput);
1640
1645
  // Get base environment with defaults
1641
- const environment = jaypieLambdaEnv({ initialEnvironment });
1646
+ const environment = jaypieLambdaEnv({ initialEnvironment, serviceTag });
1642
1647
  // Resolve secrets from mixed array (strings and JaypieSecret instances)
1643
1648
  // Use Stack.of(this) to ensure secrets are shared at stack level across all constructs
1644
1649
  const secrets = resolveSecrets(cdk.Stack.of(this), secretsInput);