https://github.com/stopsopa/vault_prototype
https://github.com/stopsopa/vault_prototype
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/stopsopa/vault_prototype
- Owner: stopsopa
- Created: 2021-07-27T09:44:23.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-06T10:30:48.000Z (almost 5 years ago)
- Last Synced: 2024-04-14T07:27:09.111Z (about 2 years ago)
- Language: Shell
- Size: 217 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://travis-ci.com/stopsopa/vault_prototype)
[](https://badge.fury.io/js/vault_prototype)
[](https://codecov.io/gh/stopsopa/vault_prototype)
# Installation
```bash
yarn add vault_prototype
npm install vault_prototype
```
# Using token
```js
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
```js
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
})
}
}());
```