Skip to content

Commit

Permalink
Divide Firebase Key file depending development and production (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
inh2613 authored Nov 12, 2023
2 parents cee4db3 + bdb30ed commit 2f6f6ac
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dev-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
uses: jsdaniell/[email protected]
with:
name: "./src/main/resources/firebase/gifthub-b2dcb-firebase-adminsdk-yj7uq-912097b9ae.json"
json: ${{ secrets.FIREBASE_JSON }}
json: ${{ secrets.FIREBASE_DEVELOPMENT_JSON }}

# Docker 이미지 build 및 push
- name: docker build and push
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dev-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
uses: jsdaniell/[email protected]
with:
name: "./src/main/resources/firebase/gifthub-b2dcb-firebase-adminsdk-yj7uq-912097b9ae.json"
json: ${{ secrets.FIREBASE_JSON }}
json: ${{ secrets.FIREBASE_DEVELOPMENT_JSON }}

# 5. 테스트를 위한 MySQL 설정
- name: Setup MySQL
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prod-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ jobs:
- name: Create Json
uses: jsdaniell/[email protected]
with:
name: "./src/main/resources/firebase/gifthub-b2dcb-firebase-adminsdk-yj7uq-912097b9ae.json"
json: ${{ secrets.FIREBASE_JSON }}
name: "./src/main/resources/firebase/gifthub-production-3d052-firebase-adminsdk-zkstv-377ec5747b.json"
json: ${{ secrets.FIREBASE_PRODUCTION_JSON }}

# Docker 이미지 build 및 push
- name: docker build and push
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prod-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ jobs:
- name: Create Json
uses: jsdaniell/[email protected]
with:
name: "./src/main/resources/firebase/gifthub-b2dcb-firebase-adminsdk-yj7uq-912097b9ae.json"
json: ${{ secrets.FIREBASE_JSON }}
name: "./src/main/resources/firebase/gifthub-production-3d052-firebase-adminsdk-zkstv-377ec5747b.json"
json: ${{ secrets.FIREBASE_PRODUCTION_JSON }}

# 5. 테스트를 위한 MySQL 설정
- name: Setup MySQL
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ out/
src/.DS_Store

# Firebase
/src/main/resources/firebase/gifthub-b2dcb-firebase-adminsdk-yj7uq-912097b9ae.json
/src/main/resources/firebase/

# Actions Secrets
actions-secrets.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.io.InputStream;
import java.util.List;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
Expand All @@ -15,9 +16,12 @@

@Configuration
public class FCMConfig {
@Value("${firebase.key-path}")
private String keyPath;

@Bean
FirebaseMessaging firebaseMessaging() throws IOException {
ClassPathResource resource = new ClassPathResource("firebase/gifthub-b2dcb-firebase-adminsdk-yj7uq-912097b9ae.json");
ClassPathResource resource = new ClassPathResource(keyPath);

InputStream refreshToken = resource.getInputStream();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private String getUUidFileName(String fileName) {
}

public String getDefaultImagePath(String dirName) {
return "https://" + cloudFrontBucketName + "/" + dirName + "/" + defaultImageFile;
return "https://" + cloudFrontBucketName + "/" + defaultImageFile;
}

public String getPresignedUrlForSaveVoucher(String dirName, String extension) {
Expand Down

0 comments on commit 2f6f6ac

Please sign in to comment.