Skip to content

Instantly share code, notes, and snippets.

View shashkiranr's full-sized avatar

Shashi Kiran R shashkiranr

View GitHub Profile
@shashkiranr
shashkiranr / db.ts
Last active March 9, 2020 17:51
GCP Secret Manager to get runtime environment credentials
import {SecretManagerServiceClient} from '@google-cloud/secret-manager';
import * as admin from 'firebase-admin';
const client = new SecretManagerServiceClient();
let credentails: admin.app.App;
export const db = async (): Promise<admin.app.App> => {
if (credentails) {
return credentails;
@shashkiranr
shashkiranr / db.ts
Created March 9, 2020 18:11
GCP Secret Manager to get runtime environment credentials for multiple environments
import {SecretManagerServiceClient} from '@google-cloud/secret-manager';
import * as admin from 'firebase-admin';
const client = new SecretManagerServiceClient();
let credentials: admin: admin.app.App;
let credentials1: admin: admin.app.App;
let credentials2: admin: admin.app.App;
export const db = async (type: string): Promise<admin: admin.app.App> => {