@jaypie/constructs 1.2.49 → 1.2.50

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.
@@ -981,12 +981,16 @@ function exportEnvName$1(name, env = process.env) {
981
981
  }
982
982
  class JaypieEnvSecret extends constructs.Construct {
983
983
  constructor(scope, idOrEnvKey, props) {
984
- // Check if idOrEnvKey should be treated as envKey:
985
- // - No props provided OR props.envKey is not set
986
- // - AND idOrEnvKey exists as a non-empty string in process.env
984
+ // Shorthand detection: treat idOrEnvKey as envKey when envKey prop is
985
+ // not set and idOrEnvKey either looks like a SCREAMING_SNAKE_CASE env
986
+ // var name or is already present in process.env. Convention-based
987
+ // detection ensures missing env vars still go through envKey validation
988
+ // instead of silently creating an empty secret.
989
+ const looksLikeEnvKey = /^[A-Z][A-Z0-9_]*$/.test(idOrEnvKey);
987
990
  const treatAsEnvKey = (!props || props.envKey === undefined) &&
988
- typeof process.env[idOrEnvKey] === "string" &&
989
- process.env[idOrEnvKey] !== "";
991
+ (looksLikeEnvKey ||
992
+ (typeof process.env[idOrEnvKey] === "string" &&
993
+ process.env[idOrEnvKey] !== ""));
990
994
  const id = treatAsEnvKey ? `EnvSecret_${idOrEnvKey}` : idOrEnvKey;
991
995
  super(scope, id);
992
996
  const { consumer = checkEnvIsConsumer$1(), envKey: envKeyProp, export: exportParam, generateSecretString, provider = checkEnvIsProvider$1(), removalPolicy, roleTag, vendorTag, value, } = props || {};