From bb74212082057a04552f52c1472747397dc771cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Herman?= Date: Wed, 28 Sep 2022 19:23:17 +0200 Subject: [PATCH] fix(firebase): use local file for firebase configuration fixes #17 --- .env.example | 4 +--- src/bot.ts | 9 +-------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.env.example b/.env.example index ed867e7..62cfd5b 100644 --- a/.env.example +++ b/.env.example @@ -1,8 +1,6 @@ DISCORD_TOKEN= REDIS_URL=redis://127.0.0.1:6379 -FIREBASE_PROJECT_ID= -FIREBASE_CLIENT_EMAIL= -FIREBASE_PRIVATE_KEY= +FIREBASE_CREDENTIALS_PATH= TWITCH_CLIENT_ID= TWITCH_CLIENT_SECRET= TWITCH_SUBSCRIPTION_SECRET= diff --git a/src/bot.ts b/src/bot.ts index 9ade9e4..301a1c4 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -30,14 +30,7 @@ dayjs.extend(relativeTime); dayjs.extend(dayjsParser); initializeApp({ - credential: cert({ - projectId: process.env.FIREBASE_PROJECT_ID, - clientEmail: process.env.FIREBASE_CLIENT_EMAIL, - privateKey: Buffer.from( - process.env.FIREBASE_PRIVATE_KEY ?? '', - 'base64', - ).toString('utf-8'), - }), + credential: cert(process.env.FIREBASE_CREDENTIALS_PATH ?? ''), }); container.database = getFirestore();