vault_prototype
v0.0.6
Published
Simple lib to fetch data from vault
Downloads
4
Readme
Installation
yarn add vault_prototype
npm install vault_prototype
Using token
const vault_prototype = require('vault_prototype');
(async function () {
try {
const vault = vault_prototype({
apiVersion: 'v1',
endpoint: 'http://127.0.0.1:3370',
token: 's.Jfium3aoAYNVvFHQpUxB8EGR' ,
});
const secrets = await vault.get(`secret/hello-world/data/test`);
console.log(secrets);
// { password: 'my-long-password', xxx: 'yyy' }
}
catch (e) {
console.log({
general_vault_error: e
})
}
}());
AppRole
https://www.vaultproject.io/docs/auth/approle#via-the-cli-1
const vault_prototype = require('vault_prototype');
(async function () {
try {
const vault = vault_prototype({
apiVersion: 'v1',
endpoint: 'http://127.0.0.1:3370'
});
await vault.generateTokenAppRole({
role_id : process.env.VAULT_ROLE_ID,
secret_id : process.env.VAULT_SECRET_ID,
});
const secrets = await vault.get(`secret/hello-world/data/test`);
console.log(secrets)
// { password: 'my-long-password', xxx: 'yyy' }
}
catch (e) {
console.log({
general_vault_error: e
})
}
}());