Skip to content

Commit

Permalink
Merge pull request #148 from UnivApp/feature/notification-refactor3
Browse files Browse the repository at this point in the history
feat: firebase 환경 변수 등록
  • Loading branch information
nyeroni authored Oct 28, 2024
2 parents 5af7ab6 + 7241d47 commit 1356c25
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/yerong/wedle/common/config/FMCConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 1356c25

Please sign in to comment.