@shushed/helpers 0.0.284 → 0.0.285
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.
|
@@ -413,10 +413,13 @@ class EnvEngine extends runtime_1.default {
|
|
|
413
413
|
if (key.startsWith('process.secret.')) {
|
|
414
414
|
key = key.slice('process.secret.'.length);
|
|
415
415
|
}
|
|
416
|
-
return this.with('
|
|
416
|
+
return this.with('__secret2_' + key, 'env', {
|
|
417
417
|
encrypted: true,
|
|
418
418
|
ephemeralMs: 5 * 60 * 1000,
|
|
419
419
|
fetch: () => {
|
|
420
|
+
if (this.secretResolved) {
|
|
421
|
+
return (this.secretResolved(key) || '');
|
|
422
|
+
}
|
|
420
423
|
return this.withGoogleAccessToken()(async (accessToken) => {
|
|
421
424
|
const secret = await (0, utils_1.getSecret)(this, key, accessToken);
|
|
422
425
|
return secret;
|
|
@@ -73,6 +73,7 @@ class Runtime {
|
|
|
73
73
|
triggerDataProperties = undefined;
|
|
74
74
|
triggerConfigProperties = undefined;
|
|
75
75
|
triggerConfig = undefined;
|
|
76
|
+
secretResolved = undefined;
|
|
76
77
|
workflowRoot;
|
|
77
78
|
constructor(opts) {
|
|
78
79
|
if (opts instanceof Runtime) {
|
|
@@ -88,6 +89,7 @@ class Runtime {
|
|
|
88
89
|
this.logging = opts.logging || new Logging(this.workflowId, this.triggerId, this.systemEnvName);
|
|
89
90
|
this.triggerName = opts.triggerName;
|
|
90
91
|
this.triggerVersion = opts.triggerVersion;
|
|
92
|
+
this.secretResolved = opts.secretResolved;
|
|
91
93
|
this.triggerDataProperties = opts.triggerDataProperties;
|
|
92
94
|
this.triggerConfigProperties = opts.triggerConfigProperties;
|
|
93
95
|
this.triggerConfig = opts.triggerConfig;
|
|
@@ -114,6 +116,9 @@ class Runtime {
|
|
|
114
116
|
this.triggerVersion = this.workflowRoot[this.triggerId]?.triggerVersion || '0.0.0';
|
|
115
117
|
this.triggerConfig = this.workflowRoot[this.triggerId]?.triggerConfig;
|
|
116
118
|
}
|
|
119
|
+
this.secretResolved = opts.secret?.get ? (key) => {
|
|
120
|
+
return opts.secret.get(key);
|
|
121
|
+
} : undefined;
|
|
117
122
|
this.systemEnvName = this.getSystemEnvName(opts);
|
|
118
123
|
this.envName = this.systemEnvName === DEFAULT_BRANCH ? 'prod' : this.systemEnvName;
|
|
119
124
|
this.pubSubPrefix = this.envName === 'prod' ? '' : `${this.envName}---`;
|
|
@@ -60,6 +60,7 @@ export default class Runtime {
|
|
|
60
60
|
readonly triggerDataProperties: Record<string, any> | undefined;
|
|
61
61
|
readonly triggerConfigProperties: Record<string, any> | undefined;
|
|
62
62
|
readonly triggerConfig: Record<string, any> | undefined;
|
|
63
|
+
secretResolved: ((key: string) => Promise<string>) | undefined;
|
|
63
64
|
readonly workflowRoot: {
|
|
64
65
|
state?: Record<string, any>;
|
|
65
66
|
[key: string]: any;
|