Skip to content
This repository has been archived by the owner on Aug 13, 2022. It is now read-only.

Commit

Permalink
[#55] 외부에서 주입한 설정 값을 사용할 수 있도록 수정
Browse files Browse the repository at this point in the history
- FileInputStream()으로 수정
  • Loading branch information
cyj199637 committed Jan 24, 2021
1 parent f85e072 commit c857dd4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
4 changes: 1 addition & 3 deletions src/main/java/me/liiot/snsserver/config/FirebaseConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.FileSystemResource;
import org.springframework.util.ResourceUtils;

import javax.annotation.PostConstruct;
import java.io.FileInputStream;
Expand All @@ -31,7 +29,7 @@ public class FirebaseConfig {
@PostConstruct
public void initialize() {
try {
InputStream serviceAccount = new FileInputStream(ResourceUtils.getFile(apiKeyPath));
InputStream serviceAccount = new FileInputStream(apiKeyPath);

FirebaseOptions options = new FirebaseOptions.Builder()
.setCredentials(GoogleCredentials.fromStream(serviceAccount))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@
import lombok.extern.slf4j.Slf4j;
import me.liiot.snsserver.enumeration.PushType;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.FileSystemResource;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.ResourceUtils;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.time.Duration;
Expand Down Expand Up @@ -64,7 +61,7 @@ public void sendPushMessage(String userId, String receiverId, PushType type, Str
private String getAccessToken() {
try {
GoogleCredential googleCredential = GoogleCredential
.fromStream(new FileInputStream(ResourceUtils.getFile(apiKeyPath)))
.fromStream(new FileInputStream(apiKeyPath))
.createScoped(Arrays.asList("https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/firebase.messaging"));
googleCredential.refreshToken();
Expand Down

0 comments on commit c857dd4

Please sign in to comment.