diff --git a/data.js b/data.js index 0bb0d89..d1c7554 100644 --- a/data.js +++ b/data.js @@ -1,12 +1,17 @@ import { Firestore } from '@google-cloud/firestore'; - -const db = new Firestore({ +import { isDev } from './utils.js'; +const config = { projectId: process.env.FIRESTORE_PROJECT_ID, - credentials: { +}; + +if (isDev()) { + config.credentials = { client_email: process.env.FIRESTORE_CLIENT_EMAIL, private_key: process.env.FIRESTORE_PRIVATE_KEY, - }, -}); + }; +} + +const db = new Firestore(config); export async function addProcessedAuctions(cars) { console.log('::: adding processed auctions :::');