@varius.io/framework 13.12.0 → 13.12.2

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.
@@ -35,16 +35,14 @@ async function fetchVaultTokenViaKubernetesAuth(role) {
35
35
  }
36
36
 
37
37
  async function getVaultToken() {
38
- const envToken = process.env.VAULT_ENV_VAULT_TOKEN;
39
- const envRole = process.env.VAULT_ENV_ROLE;
40
-
41
- if (envToken) {
42
- return envToken;
43
- } else if (envRole) {
44
- return await fetchVaultTokenViaKubernetesAuth(envRole);
45
- } else {
46
- throw new Error("No available vault auth mechanism.");
38
+ const token = process.env.VAULT_ENV_VAULT_TOKEN;
39
+
40
+ if (token) {
41
+ return token;
47
42
  }
43
+
44
+ const role = process.env.VAULT_ENV_ROLE ?? "default";
45
+ return await fetchVaultTokenViaKubernetesAuth(role);
48
46
  }
49
47
 
50
48
  async function fetchSecret(secretPath) {
@@ -118,12 +116,12 @@ async function main() {
118
116
  const oldRejectUnauthorized = process.env.NODE_TLS_REJECT_UNAUTHORIZED;
119
117
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
120
118
 
121
- const newEnv = await setupEnv();
119
+ const resolvedEnv = await resolveEnv();
122
120
 
123
121
  // reset self-signed cert permission, for the child process
124
122
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = oldRejectUnauthorized;
125
123
 
126
- process.env = { ...process.env, ...newEnv };
124
+ process.env = { ...process.env, ...resolvedEnv };
127
125
 
128
126
  for (const key of Object.keys(process.env)) {
129
127
  if (key.startsWith("VAULT_ENV")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varius.io/framework",
3
- "version": "13.12.0",
3
+ "version": "13.12.2",
4
4
  "main": "./build/index.js",
5
5
  "type": "./build/index.d.ts",
6
6
  "scripts": {