vvauth 0.1.3 → 0.1.5
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/index.js +5 -15
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -9,7 +9,6 @@ const net = require('net');
|
|
|
9
9
|
const {spawn} = require('child_process');
|
|
10
10
|
|
|
11
11
|
const {parse} = require('yaml');
|
|
12
|
-
const {args, dict} = require('nyks/process/parseArgs')();
|
|
13
12
|
const SSHAgent = require('ssh-agent-js/client');
|
|
14
13
|
const trim = require('mout/string/trim');
|
|
15
14
|
const get = require('mout/object/get');
|
|
@@ -29,9 +28,9 @@ const logger = {
|
|
|
29
28
|
};
|
|
30
29
|
|
|
31
30
|
|
|
32
|
-
const VAUTH_RC = ".vauthrc";
|
|
31
|
+
const VAUTH_RC = process.env.VAUTHRC || ".vauthrc";
|
|
33
32
|
const FUNCTION_NAME = "vauth";
|
|
34
|
-
const FUNCTION_DECL = "function vauth() { source <(/usr/bin/env vvauth --source
|
|
33
|
+
const FUNCTION_DECL = "function vauth() { source <(/usr/bin/env vvauth --ir://raw --source --ir://run=$1 \"${@:2}\"); }";
|
|
35
34
|
|
|
36
35
|
class vvauth {
|
|
37
36
|
constructor(rc = null) {
|
|
@@ -44,6 +43,7 @@ class vvauth {
|
|
|
44
43
|
this.rc = walk(parse(body), v => replaceEnv(v, { env : process.env}));
|
|
45
44
|
}
|
|
46
45
|
}
|
|
46
|
+
|
|
47
47
|
let {vault_addr} = this.rc;
|
|
48
48
|
if(!vault_addr)
|
|
49
49
|
throw `Invalid vault remote`;
|
|
@@ -155,18 +155,8 @@ class vvauth {
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
//ensure module is called directly, i.e. not required
|
|
158
|
-
if(module.parent === null)
|
|
159
|
-
|
|
160
|
-
if(cmd && i != -1)
|
|
161
|
-
process.argv.splice(i, 1);
|
|
162
|
-
|
|
163
|
-
if(dict['source'] && !cmd) {
|
|
164
|
-
console.error(`please use "${FUNCTION_NAME} login"`);
|
|
165
|
-
process.exit(1);
|
|
166
|
-
}
|
|
167
|
-
let run = cmd ? [`--ir://raw`, `--ir://run=${cmd}`] : [];
|
|
168
|
-
require('cnyks/lib/bundle')(vvauth, null, run);
|
|
169
|
-
}
|
|
158
|
+
if(module.parent === null)
|
|
159
|
+
require('cnyks/lib/bundle')(vvauth);
|
|
170
160
|
|
|
171
161
|
|
|
172
162
|
module.exports = vvauth;
|