@jaypie/constructs 1.1.60 → 1.1.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.
|
@@ -17,7 +17,7 @@ export interface JaypieEnvSecretProps {
|
|
|
17
17
|
export declare class JaypieEnvSecret extends Construct implements ISecret {
|
|
18
18
|
private readonly _envKey?;
|
|
19
19
|
private readonly _secret;
|
|
20
|
-
constructor(scope: Construct,
|
|
20
|
+
constructor(scope: Construct, idOrEnvKey: string, props?: JaypieEnvSecretProps);
|
|
21
21
|
get stack(): Stack;
|
|
22
22
|
get env(): {
|
|
23
23
|
account: string;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1690,9 +1690,17 @@ function exportEnvName(name, env = process.env) {
|
|
|
1690
1690
|
return cleanName(rawName);
|
|
1691
1691
|
}
|
|
1692
1692
|
class JaypieEnvSecret extends constructs.Construct {
|
|
1693
|
-
constructor(scope,
|
|
1693
|
+
constructor(scope, idOrEnvKey, props) {
|
|
1694
|
+
// Check if idOrEnvKey should be treated as envKey:
|
|
1695
|
+
// - No props provided OR props.envKey is not set
|
|
1696
|
+
// - AND idOrEnvKey exists as a non-empty string in process.env
|
|
1697
|
+
const treatAsEnvKey = (!props || props.envKey === undefined) &&
|
|
1698
|
+
typeof process.env[idOrEnvKey] === "string" &&
|
|
1699
|
+
process.env[idOrEnvKey] !== "";
|
|
1700
|
+
const id = treatAsEnvKey ? `EnvSecret_${idOrEnvKey}` : idOrEnvKey;
|
|
1694
1701
|
super(scope, id);
|
|
1695
|
-
const { consumer = checkEnvIsConsumer(), envKey, export: exportParam, generateSecretString, provider = checkEnvIsProvider(), roleTag, vendorTag, value, } = props || {};
|
|
1702
|
+
const { consumer = checkEnvIsConsumer(), envKey: envKeyProp, export: exportParam, generateSecretString, provider = checkEnvIsProvider(), roleTag, vendorTag, value, } = props || {};
|
|
1703
|
+
const envKey = treatAsEnvKey ? idOrEnvKey : envKeyProp;
|
|
1696
1704
|
this._envKey = envKey;
|
|
1697
1705
|
let exportName;
|
|
1698
1706
|
if (!exportParam) {
|