Hashicorp Vault wrapper for NestJS
npm install nest-vaultThis dynamic module was generated with Nest Dynamic Package Generator Schematics. You can read more about using the generator here.
To install this generated project:
``bash`
npm install nest-vault --save
(or yarn equivalent)
You can test this module if Hashicorp Vault is running locally at http://127.0.0.1:8200/v1 (or you can edit the .env file to change this URL).
`bash`
cd ./node_modules/nest-vault
npm run start:dev
Then connect to http://localhost:3000 and you should see the status of your vault.
`javascript
@Module({
imports: [
ConfigModule.forRoot({}),
NestVaultModule.registerAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: (configService: ConfigService) => {
return {
baseUrl: configService.get('VAULT_URL'),
};
},
}),
],
})
`
Look at src/nest-vault-client for more details.
This wrapper is using hashi-vault-js module, so take a look how to use it.
`javascript
@Controller()
export class NestVaultClientController {
constructor(@Inject(VAULT_CONNECTION) private readonly vault) {}
@Get()
async index() {
return await this.vault.healthCheck();
}
}
``
Good luck!