@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.
- package/dist/cjs/index.cjs +9 -5
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +9 -5
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -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
|
-
//
|
|
985
|
-
//
|
|
986
|
-
//
|
|
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
|
-
|
|
989
|
-
|
|
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 || {};
|