Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Godofbrowser/93f8fe5868e380f29174830c2efa2ba2 to your computer and use it in GitHub Desktop.
Save Godofbrowser/93f8fe5868e380f29174830c2efa2ba2 to your computer and use it in GitHub Desktop.
This gist shows how to use the env var GCLOUD_CREDENTIALS provided by now.sh after google cloud storage integration
const {Storage} = require('@google-cloud/storage');
const fromB64 = (string) => Buffer.from(string, 'base64').toString();
const credentials = JSON.parse(fromB64(process.env.GCLOUD_CREDENTIALS))
const storage = new Storage(credentials ? {credentials} : undefined)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment