Skip to content

Instantly share code, notes, and snippets.

@vijayakumar-psg587
Created April 21, 2020 07:47
Show Gist options
  • Save vijayakumar-psg587/50ea5c0064732f6938898d87cbe98104 to your computer and use it in GitHub Desktop.
Save vijayakumar-psg587/50ea5c0064732f6938898d87cbe98104 to your computer and use it in GitHub Desktop.
import {Storage} from '@google-cloud/storage';
import { AuthenticationModel } from '../models/authentication.model';
import { AppUtilServiceInstance } from './app.util.service';
import * as pino from 'pino';
import { PinoLoggerServiceInstance } from './pino.logger.service';
export class GcloudAuthentication {
private gcloudAuthModel: AuthenticationModel;
private LOGGER: pino.Logger;
constructor() {
this.gcloudAuthModel = AppUtilServiceInstance.getGcloudAuthModel();
this.LOGGER = PinoLoggerServiceInstance.getLogger(__filename);
}
createGcloudAuthenticationBucket():Storage {
// @ts-ignore
console.log(this.gcloudAuthModel);
return new Storage({
autoRetry: this.gcloudAuthModel.autoRetry,
keyFilename: this.gcloudAuthModel.keyFilename,
maxRetries: this.gcloudAuthModel.maxRetries,
projectId: this.gcloudAuthModel.projectId,
scopes: this.gcloudAuthModel.scope,
});
};
}
export const GcloudAuthenticationInstance = new GcloudAuthentication();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment