From 3c3d8837d27b389c8372e39627d33df3e4b17b54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=8A=B9=EC=9B=90=20Merry?= Date: Fri, 6 Oct 2023 20:35:20 +0900 Subject: [PATCH] =?UTF-8?q?Revert=20"refactor:=20#386=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=EB=8D=95=EC=85=98=20=ED=99=98=EA=B2=BD=EC=9D=98=20FCM=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=EA=B3=BC=20=EB=A1=9C=EC=BB=AC=20=ED=99=98?= =?UTF-8?q?=EA=B2=BD=EC=9D=98=20FCM=20=EB=B6=84=EB=A6=AC=20(#393)"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 4a7420bc42057f495a9af63a298c749f712ce7eb. --- ...nfiguration.java => FcmConfiguration.java} | 4 +- .../fcm/LocalFcmConfiguration.java | 40 ------------------- 2 files changed, 2 insertions(+), 42 deletions(-) rename backend/ddang/src/main/java/com/ddang/ddang/configuration/fcm/{ProdFcmConfiguration.java => FcmConfiguration.java} (96%) delete mode 100644 backend/ddang/src/main/java/com/ddang/ddang/configuration/fcm/LocalFcmConfiguration.java diff --git a/backend/ddang/src/main/java/com/ddang/ddang/configuration/fcm/ProdFcmConfiguration.java b/backend/ddang/src/main/java/com/ddang/ddang/configuration/fcm/FcmConfiguration.java similarity index 96% rename from backend/ddang/src/main/java/com/ddang/ddang/configuration/fcm/ProdFcmConfiguration.java rename to backend/ddang/src/main/java/com/ddang/ddang/configuration/fcm/FcmConfiguration.java index ac0848a4b..be95af35c 100644 --- a/backend/ddang/src/main/java/com/ddang/ddang/configuration/fcm/ProdFcmConfiguration.java +++ b/backend/ddang/src/main/java/com/ddang/ddang/configuration/fcm/FcmConfiguration.java @@ -16,8 +16,8 @@ import org.springframework.context.annotation.Profile; @Configuration -@Profile("!test && !local") -public class ProdFcmConfiguration { +@Profile("!test") +public class FcmConfiguration { @Value("${fcm.key.path}") private String FCM_PRIVATE_KEY_PATH; diff --git a/backend/ddang/src/main/java/com/ddang/ddang/configuration/fcm/LocalFcmConfiguration.java b/backend/ddang/src/main/java/com/ddang/ddang/configuration/fcm/LocalFcmConfiguration.java deleted file mode 100644 index d2bf7a58a..000000000 --- a/backend/ddang/src/main/java/com/ddang/ddang/configuration/fcm/LocalFcmConfiguration.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ddang.ddang.configuration.fcm; - -import com.google.firebase.FirebaseApp; -import com.google.firebase.FirebaseOptions; -import com.google.firebase.messaging.FirebaseMessaging; -import java.util.List; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; - -@Configuration -@Profile("local") -public class LocalFcmConfiguration { - - @Bean - public FirebaseMessaging firebaseMessaging() { - final FirebaseApp firebaseApps = findFirebaseApps(); - - return FirebaseMessaging.getInstance(firebaseApps); - } - - private FirebaseApp findFirebaseApps() { - final List apps = FirebaseApp.getApps(); - - if (!apps.isEmpty()) { - for (final FirebaseApp app : apps) { - if (FirebaseApp.DEFAULT_APP_NAME.equals(app.getName())) { - return app; - } - } - } - - final FirebaseOptions options = FirebaseOptions.builder() - .setCredentials(new MockGoogleCredentials("test-token")) - .setProjectId("test-project") - .build(); - - return FirebaseApp.initializeApp(options); - } -}