From c229ad4f597f050b7a8fd4667577b1bccb74155d Mon Sep 17 00:00:00 2001 From: kdh8219 <65698239+kdh8219@users.noreply.github.com> Date: Fri, 28 Apr 2023 22:00:01 +0900 Subject: [PATCH] edit .env for firebase --- .env.example | 8 ++++---- src/wrapper/firebase.ts | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.env.example b/.env.example index 7b4234d..8bff73b 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,7 @@ # FIREBASE -# cert data to string -FIREBASE_CERT = "JSON.stringify(the_file)" - +FIREBASE_CERT_PROJECT_ID = +FIREBASE_CERT_CLIENT_EMAIL = +FIREBASE_CERT_PRIVATE_KEY = # DISCORD # discord bot token @@ -13,4 +13,4 @@ DISCORD_TARGRT_GUILD_ID = "" # ETC # server name -RUNNER_NAME = "" +RUNNER_NAME="" diff --git a/src/wrapper/firebase.ts b/src/wrapper/firebase.ts index ec47401..3c3125c 100644 --- a/src/wrapper/firebase.ts +++ b/src/wrapper/firebase.ts @@ -4,7 +4,11 @@ import { config } from "dotenv"; config(); initializeApp({ - credential: cert(JSON.parse(process.env.FIREBASE_CERT as string)), + credential: cert({ + projectId: process.env.FIREBASE_CERT_PROJECT_ID, + clientEmail: process.env.FIREBASE_CERT_CLIENT_EMAIL, + privateKey: process.env.FIREBASE_CERT_PRIVATE_KEY?.replace(/\\n/g, "\n"), + }), }); const db = getFirestore();