Skip to content

Commit

Permalink
[Feat] fcm api migration #209 (#210)
Browse files Browse the repository at this point in the history
* setting(firebase-admin): 버전 8.1.0 에서 9.3.0 으로 업데이트

* setting: FCM 파일 변경

* feat(FirebaseConfig): Firebase app bean 생성 방식 변경
  • Loading branch information
zbqmgldjfh authored Aug 8, 2024
1 parent b588b51 commit 20efafd
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/decrypt.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

gpg --batch --yes --decrypt --passphrase "$GPG_PASSPHRASE" --output src/main/resources/third/ku-stack-firebase-adminsdk-87nwq-5ba04dfc12.json src/main/resources/third/ku-stack-firebase-adminsdk-87nwq-5ba04dfc12.json.gpg
gpg --batch --yes --decrypt --passphrase "$GPG_PASSPHRASE" --output src/main/resources/third/ku-stack-firebase-adminsdk-87nwq-ae6a2df931.json src/main/resources/third/ku-stack-firebase-adminsdk-87nwq-ae6a2df931.json.gpg

if [ -f src/main/resources/third/ku-stack-firebase-adminsdk-87nwq-5ba04dfc12.json ]; then
if [ -f src/main/resources/third/ku-stack-firebase-adminsdk-87nwq-ae6a2df931.json ]; then
echo "Decryption Success!"
fi
fi
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ dependencies {
implementation 'org.jsoup:jsoup:1.14.3'

// Firebase
implementation 'com.google.firebase:firebase-admin:8.1.0'
implementation 'com.google.firebase:firebase-admin:9.3.0'

// RestDocs
asciidoctorExtensions 'org.springframework.restdocs:spring-restdocs-asciidoctor'
Expand Down
11 changes: 7 additions & 4 deletions src/main/java/com/kustacks/kuring/config/FirebaseConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ FirebaseMessaging firebaseMessaging(FirebaseApp firebaseApp) {

@Bean
FirebaseApp firebaseApp(@Value("${firebase.file-path}") String filePath) throws IOException {
FirebaseOptions options = FirebaseOptions.builder()
.setCredentials(GoogleCredentials.fromStream(new ClassPathResource(filePath).getInputStream()))
GoogleCredentials googleCredentials = GoogleCredentials
.fromStream(new ClassPathResource(filePath).getInputStream());

FirebaseOptions firebaseOptions = FirebaseOptions.builder()
.setCredentials(googleCredentials)
.build();

if(FirebaseApp.getApps().isEmpty()) {
return FirebaseApp.initializeApp(options);
if (FirebaseApp.getApps().isEmpty()) {
return FirebaseApp.initializeApp(firebaseOptions);
}

return FirebaseApp.getInstance();
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ auth:
login-url: https://kuis.konkuk.ac.kr/Login/login.do

firebase:
file-path: third/ku-stack-firebase-adminsdk-87nwq-5ba04dfc12.json
file-path: third/ku-stack-firebase-adminsdk-87nwq-ae6a2df931.json

admin:
password: ${ADMIN_PASSWORD}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ auth:
login-url: https://kuis.konkuk.ac.kr/Login/login.do

firebase:
file-path: third/ku-stack-firebase-adminsdk-87nwq-5ba04dfc12.json
file-path: third/ku-stack-firebase-adminsdk-87nwq-ae6a2df931.json

admin:
password: ${ADMIN_PASSWORD}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ auth:
login-url: https://kuis.konkuk.ac.kr/Login/login.do

firebase:
file-path: third/ku-stack-firebase-adminsdk-87nwq-5ba04dfc12.json
file-path: third/ku-stack-firebase-adminsdk-87nwq-ae6a2df931.json

admin:
password: ${ADMIN_PASSWORD}
Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion src/test/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ server:
environment: test

firebase:
file-path: third/ku-stack-firebase-adminsdk-87nwq-5ba04dfc12.json
file-path: third/ku-stack-firebase-adminsdk-87nwq-ae6a2df931.json

admin:
id: [email protected]
Expand Down

0 comments on commit 20efafd

Please sign in to comment.