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();