# confabulous-vault-loader

> A confabulous vault loader

Latest version **0.1.6** (published 2016-07-04) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install confabulous-vault-loader
pnpm add confabulous-vault-loader
yarn add confabulous-vault-loader
bun add confabulous-vault-loader
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2016-07-04 |
| First published | 2016-06-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | GuideSmiths Ltd |
| Maintainers | guidesmiths |
| Keywords | Confabulous, Vault, Hashicorp, Loader, Config |

## Links

- npm: https://www.npmjs.com/package/confabulous-vault-loader
- Repository: https://github.com/guidesmiths/confabulous-vault-loader
- Homepage: https://github.com/guidesmiths/confabulous-vault-loader#readme
- Issues: https://github.com/guidesmiths/confabulous-vault-loader/issues
- npm.io page: https://npm.io/package/confabulous-vault-loader

## Dependencies (6)

- [async](https://npm.io/package/async.md) ^2.0.0-rc.6
- [debug](https://npm.io/package/debug.md) ^2.2.0
- [request](https://npm.io/package/request.md) ^2.72.0
- [lodash.merge](https://npm.io/package/lodash.merge.md) ^4.4.0
- [parse-duration](https://npm.io/package/parse-duration.md) ^0.1.1
- [lodash.contains](https://npm.io/package/lodash.contains.md) ^2.4.3

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.1.6 (latest) — 2016-07-04
- 0.1.5 — 2016-07-04
- 0.1.4 — 2016-06-26
- 0.1.3 — 2016-06-24
- 0.1.2 — 2016-06-24

## README

# Confabulous Vault Loader
Confabulous-Vault-Loader is an Vault Loader for [Confabulous](https://github.com/guidesmiths/confabulous) - a hierarchical, asynchronous config loader and post processor.

## TL;DR
```
const confabulous = require('confabulous')
const Confabulous = confabulous.Confabulous
const vault = require('confabulous-vault-loader')
const processors = confabulous.processors

new Confabulous()
    .add((config) => vault({ url: 'http://localhost:8200', path: 'secret/live/demo', method: 'app-id', appId: 'svc-demo-api' , userId: 'demo-live' }))
    .on('loaded', (config) => console.log('Loaded', JSON.stringify(config, null, 2)))
    .on('reloaded', (config) => console.log('Reloaded', JSON.stringify(config, null, 2)))
    .on('error', (err) => console.error('Error', err))
    .on('reload_error', (err) => console.error('Reload Error', err))
    .end()
```

### Options
|  Option   |  Type   |  Default  |  Notes  |
|-----------|---------|-----------|---------|
| url       | string  |           | URL of the vault server |
| path      | string  |           | Path to the encrypted config |
| method    | string  |           | Authentication method (currently only app-id is supported) |
| appId     | string  |           | Application Id (required for authentication when using app-id method) |
| userId    | string  |           | User Id (required for authentication when using app-id method) |
| mandatory | boolean | true      | Causes an error/reload_error to be emitted if the configuration does not exist |
| watch     | object  |           | Polls the vault server for changes. Requires an interval, e.g. ```{ interval: '5m'}``` |
| request   | object  | [see here](https://github.com/guidesmiths/confabulous/blob/master/lib/loaders/http.js#L14) | options that will be passed to [the underlying http client](https://github.com/request/request).

## Testing Locally
Setting up a vault environment is no easy task. The following might help...

### Start a vault server in development mode
```
docker run -d -p 8200:8200 --hostname vault --name vault sjourdan/vault
docker logs vault
```
### Make note of the Unseal Key and Root Token and configure exports
```
export VAULT_ADDR=http://vault:8200
export VAULT_TOKEN=<INSERT_TOKEN_HERE>
```
### Create an alias so you can execute vault commands from a container
```
alias vaultcmd="docker run --volume $(pwd)/tests/vault:/tmp --link vault --rm -e VAULT_ADDR -e VAULT_TOKEN sjourdan/vault"
```
### Unseal the vault so you can read / write secrets
```
vaultcmd unseal <INSERT_UNSEAL_KEY>
```
### Upload a policy
```
vaultcmd policy-write demo-live /tmp/policies/live/demo.json
```
### Configure an app-id login
```
vaultcmd auth-enable app-id
vaultcmd write auth/app-id/map/app-id/svc-demo-api value=demo-live display_name=svc-demo-api
vaultcmd write auth/app-id/map/user-id/demo-live value=svc-demo-api
vaultcmd policy-write demo-live /tmp/policies/live/demo.json
```

You should now be able to run tests. Hoorah!

---
_Source: https://npm.io/package/confabulous-vault-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
