Skip to content

Instantly share code, notes, and snippets.

@bacongravy
Created June 7, 2020 23:59
Show Gist options
  • Select an option

  • Save bacongravy/8aaf497577cf5bc3b9df4177e6ef8b8c to your computer and use it in GitHub Desktop.

Select an option

Save bacongravy/8aaf497577cf5bc3b9df4177e6ef8b8c to your computer and use it in GitHub Desktop.
const Firestore = require("@google-cloud/firestore");
let credentials = {};
try {
credentials = JSON.parse(process.env.FIREBASE_SERVICE_ACCOUNT);
} catch {
console.error("Could not parse process.env.FIREBASE_SERVICE_ACCOUNT");
}
module.exports = new Firestore({ projectId: credentials.project_id, credentials });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment