nest-vault
v1.0.3
Published
Hashicorp Vault wrapper for NestJS
Downloads
426
Readme
This dynamic module was generated with Nest Dynamic Package Generator Schematics. You can read more about using the generator here.
Installation
To install this generated project:
npm install nest-vault --save
(or yarn equivalent)
Test
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).
cd ./node_modules/nest-vault
npm run start:dev
Then connect to http://localhost:3000 and you should see the status of your vault.
Usage
@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.
@Controller()
export class NestVaultClientController {
constructor(@Inject(VAULT_CONNECTION) private readonly vault) {}
@Get()
async index() {
return await this.vault.healthCheck();
}
}
Good luck!