From 7241d47dca40f996264676360b520fe00b616aaf Mon Sep 17 00:00:00 2001 From: Sin Ye Rin <91180366+nyeroni@users.noreply.github.com> Date: Mon, 28 Oct 2024 17:14:19 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20firebase=20=ED=99=98=EA=B2=BD=20?= =?UTF-8?q?=EB=B3=80=EC=88=98=20=EB=93=B1=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/yerong/wedle/common/config/FMCConfig.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/yerong/wedle/common/config/FMCConfig.java b/src/main/java/yerong/wedle/common/config/FMCConfig.java index 1b20fef..263ef0f 100644 --- a/src/main/java/yerong/wedle/common/config/FMCConfig.java +++ b/src/main/java/yerong/wedle/common/config/FMCConfig.java @@ -3,6 +3,8 @@ import com.google.auth.oauth2.GoogleCredentials; import com.google.firebase.FirebaseApp; import com.google.firebase.FirebaseOptions; + +import java.io.ByteArrayInputStream; import java.io.IOException; import javax.annotation.PostConstruct; import org.springframework.context.annotation.Configuration; @@ -13,11 +15,11 @@ public class FMCConfig { @PostConstruct private void init() throws IOException { - String fileResourceURL = "security/wedle-94dad-firebase-adminsdk-3qavr-19fe7c2a51.json"; - ClassPathResource resource = new ClassPathResource(fileResourceURL); + String firebaseConfig = System.getenv("FIREBASE_CONFIG"); + ByteArrayInputStream serviceAccountStream = new ByteArrayInputStream(firebaseConfig.getBytes()); FirebaseOptions options = FirebaseOptions.builder() - .setCredentials(GoogleCredentials.fromStream(resource.getInputStream())) + .setCredentials(GoogleCredentials.fromStream(serviceAccountStream)) .build(); FirebaseApp.initializeApp(options);