Skip to content

Commit

Permalink
[CHORE] 파일 경로 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
sangminee committed Mar 11, 2024
1 parent f65a7dd commit 579f862
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/main/java/com/oya/kr/chat/config/FCMInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import javax.annotation.PostConstruct;

import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.InputStreamResource;
Expand Down Expand Up @@ -44,14 +45,11 @@ public class FCMInitializer {
public void initialize() throws IOException {
if (!initialized) {
try {
// EC2 root 디렉토리에 있는 파일에 접근하기 위해 FileSystemResource를 사용
Resource resource = new FileSystemResource("/home/ubuntu/firebase.json");
Resource resource = new ClassPathResource("firebase.json");

byte[] jsonBytes = getJsonBytes(resource);
String jsonContent = new String(jsonBytes, StandardCharsets.UTF_8);

log.info("Firebase JSON 파일 내용:\n{}", jsonContent);

GoogleCredentials googleCredentials = GoogleCredentials.fromStream(new ByteArrayInputStream(jsonBytes))
.createScoped(Arrays.asList("https://www.googleapis.com/auth/cloud-platform"));
FirebaseOptions options = new FirebaseOptions.Builder()
Expand Down

0 comments on commit 579f862

Please sign in to comment.