Skip to content

Commit 5432bcf

Browse files
authored
Fix: [FCM] FCM 설정 수정 (#78)
1 parent 9639381 commit 5432bcf

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

runtracker/src/main/java/com/runtracker/global/fcm/FirebaseConfig.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ public void initialize() {
2929
new java.io.ByteArrayInputStream(firebaseJson.getBytes())
3030
);
3131
} else if (serviceAccountKeyPath != null && !serviceAccountKeyPath.isEmpty()) {
32+
String resourcePath = serviceAccountKeyPath.startsWith("classpath:")
33+
? serviceAccountKeyPath.substring(10)
34+
: serviceAccountKeyPath;
3235
googleCredentials = GoogleCredentials
33-
.fromStream(new ClassPathResource(serviceAccountKeyPath).getInputStream());
36+
.fromStream(new ClassPathResource(resourcePath).getInputStream());
3437
} else {
35-
googleCredentials = GoogleCredentials
36-
.fromStream(new ClassPathResource("firebase/runtracker-a30bb-firebase-adminsdk-fbsvc-9479026564.json").getInputStream());
38+
throw new RuntimeException("Firebase service account key not found. Please set FCM_JSON or FIREBASE_SERVICE_ACCOUNT_KEY");
3739
}
3840

3941
FirebaseOptions options = FirebaseOptions.builder()

0 commit comments

Comments
 (0)