nestjs-gcloud-secret-manager
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

Summary

Google Cloud Secret Manager module for Nest.js

Installation

$ yarn add nestjs-gcloud-secret-manager

Examples

Setup

import { Module } from '@nestjs/common';
import { SecretManagerModule } from 'nestjs-gcloud-secret-manager';

@Module({
  imports: [
    /**
     * secrets are loaded to `SecretManagerService` when SecretManagerModule bootstrapped
     */
    SecretManagerModule.forRoot({
      projectId,
      credentials
    })
  ],
})
export class AppModule {}

using secret manager service

import { Injectable } from '@nestjs/common';
import { SecretManagerService } from 'nestjs-gcloud-secret-manager';

@Injectable()
export class AppService {
    constructor(private readonly secretManagerService: SecretManagerService) {}
    async getSecret() {
        this.secretManagerService.get(SECRET_NAME);
    }
}

using secret manager client

Functions such as creation have not yet been implemented. If you want to extend the functionality, use client as it is.

import { Inject } from '@nestjs/common';
import { CLIENT_INSTANCE, SecretManagerClient } from 'nestjs-gcloud-secret-manager';

export class AppService {
  constructor(@Inject(CLIENT_INSTANCE) private readonly client: SecretManagerClient) {}
}

Readme

Keywords

none

Package Sidebar

Install

npm i nestjs-gcloud-secret-manager

Weekly Downloads

2

Version

0.4.0

License

MIT

Unpacked Size

195 kB

Total Files

38

Last publish

Collaborators

  • bino0216