vvauth 0.1.2 → 0.1.3

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 +7 -11
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -31,7 +31,7 @@ const logger = {
31
31
 
32
32
  const VAUTH_RC = ".vauthrc";
33
33
  const FUNCTION_NAME = "vauth";
34
- const FUNCTION_DECL = "function vauth() { source <(/usr/bin/env vauth --source $*); }";
34
+ const FUNCTION_DECL = "function vauth() { source <(/usr/bin/env vvauth --source $*); }";
35
35
 
36
36
  class vvauth {
37
37
  constructor(rc = null) {
@@ -44,6 +44,10 @@ class vvauth {
44
44
  this.rc = walk(parse(body), v => replaceEnv(v, { env : process.env}));
45
45
  }
46
46
  }
47
+ let {vault_addr} = this.rc;
48
+ if(!vault_addr)
49
+ throw `Invalid vault remote`;
50
+ console.error("vauth bound to '%s'", vault_addr);
47
51
  }
48
52
 
49
53
  async _get_token() {
@@ -60,18 +64,10 @@ class vvauth {
60
64
  return token;
61
65
  }
62
66
 
63
- async login(publish = true) {
64
- if(!dict['source'] && publish) {
65
- console.error(`echo please use "${FUNCTION_NAME} login"`);
66
- process.exit(1);
67
- }
68
-
69
- let {vault_addr} = this.rc;
70
- console.error("Connecting to %s", vault_addr);
71
-
67
+ async login(source = false) {
72
68
 
73
69
  let VAULT_TOKEN = await this._get_token();
74
- if(publish) {
70
+ if(source) {
75
71
  let env = {VAULT_TOKEN};
76
72
  this._publish_env(env);
77
73
  process.exit();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vvauth",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Vault Auth helper",
5
5
  "main": "index.js",
6
6
  "bin": {