vvauth 2.0.2 → 2.0.4

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.
Files changed (2) hide show
  1. package/index.js +14 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -85,13 +85,15 @@ class vvauth {
85
85
  this.rc = walk(rc, v => replaceEnv(v, {env}));
86
86
  }
87
87
 
88
- this.VAULT_ADDR = this.rc.vault_addr;
89
-
90
- if(!this.VAULT_ADDR)
91
- throw `Invalid vault remote`;
92
88
 
89
+ this.VAULT_ADDR = this.rc.vault_addr; //might be null
93
90
  this.VAULT_TOKEN = process.env.VAULT_TOKEN;
94
- console.error("vauth bound to '%s'", this.VAULT_ADDR);
91
+
92
+ if(this.VAULT_ADDR)
93
+ console.error("vauth bound to '%s'", this.VAULT_ADDR);
94
+ else
95
+ console.error("Not bound to any vault");
96
+
95
97
  }
96
98
 
97
99
  async run() {
@@ -172,9 +174,15 @@ class vvauth {
172
174
  let {profile, database} = await this._vault_get_profile();
173
175
  profile = {...database, ...profile};
174
176
 
175
- let env = {VAULT_TOKEN : this.VAULT_TOKEN, VAULT_ADDR : this.VAULT_ADDR}, secrets = {},
177
+ let env = {}, secrets = {},
176
178
  {git, map = {}, paths, path : mount = "secrets"} = this.rc.env || {};
177
179
 
180
+ if(this.VAULT_TOKEN)
181
+ env.VAULT_TOKEN = this.VAULT_TOKEN;
182
+ if(this.VAULT_ADDR)
183
+ env.VAULT_ADDR = this.VAULT_ADDR;
184
+
185
+
178
186
  let {'ssh-agent-crypt' : agent } = this.rc;
179
187
  if(agent) {
180
188
  const {path, identity} = agent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vvauth",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "Vault Auth helper",
5
5
  "main": "index.js",
6
6
  "bin": {