From d5f187bb070e86c0d9e0aa8904d68e28544f9dd0 Mon Sep 17 00:00:00 2001 From: Jhonnatan Gonzalez Rodriguez Date: Tue, 18 Jul 2023 06:39:27 +0200 Subject: [PATCH] adjust config based on environment --- data.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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 :::');