Created
June 29, 2019 22:42
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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