chiefy / vaulted

nodejs based wrapper for HashiCorp's Vault HTTP API
https://chiefy.github.io/vaulted
MIT License
47 stars 6 forks source link

Configuration Issues #38

Closed kenjones-cisco closed 8 years ago

kenjones-cisco commented 8 years ago

Optional configurations not supported based on library documentation. _From convict documentation:_

 Default values: Every setting must have a default value.

Most of the configurations do not have defaults as they are considered optional.

_Accessing values with no defaults_

var store = new Vault({
  vault_host: VAULT_HOST,
  vault_port: 8200,
  vault_ssl: 0
});

console.log('has vault_token: ', store.config.has('vault_token'));
console.log('get vault_token: ', store.config.get('vault_token'));

_Result_

has vault_token:  true
get vault_token:  { doc: 'Token to use to access the vault', env: 'VAULT_TOKEN' }

_Accessing values with value set on the env_

process.env.VAULT_TOKEN = 'abcxyz';
store = new Vault({
  vault_host: VAULT_HOST,
  vault_port: 8200,
  vault_ssl: 0
});

console.log('has vault_token: ', store.config.has('vault_token'));
console.log('vault_token: ', store.config.get('vault_token'));

console.log('secret_shares: ', store.config.get('secret_shares'));

_Result_

has vault_token:  true
vault_token:  { doc: 'Token to use to access the vault', env: 'VAULT_TOKEN' }
secret_shares:  3

Setting to null as the default causes errors.

_Result_

C:\Work\ioe\vaulted\node_modules\convict\lib\convict.js:415
        throw new Error(errBuf);
        ^

Error: ssl_cert_file: must be of type String
ssl_pem_file: must be of type String
ssl_pem_passphrase: must be of type String
ssl_ca_cert: must be of type String
proxy_address: must be of type String
proxy_port: must be of type String
proxy_username: must be of type String
proxy_password: must be of type String
    at Object.rv.validate (C:\Work\ioe\vaulted\node_modules\convict\lib\convict.js:415:15)
    at config (C:\Work\ioe\vaulted\lib\config.js:145:8)
    at new Vaulted (C:\Work\ioe\vaulted\lib\vaulted.js:26:17)
    at Object.<anonymous> (C:\Work\ioe\vaulted\sample.js:8:13)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:467:10)
    at startup (node.js:136:18)
    at node.js:963:3