Skip to content

Commit

Permalink
[MERGE/#43] JSON 파일 ClassPathResource 객체로 열기
Browse files Browse the repository at this point in the history
[FIX/#43] JSON 파일 ClassPathResource 객체로 열기
  • Loading branch information
seokbeom00 authored Jul 9, 2024
2 parents 81fab4b + 1ba1b93 commit 706b74c
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@
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;

@Configuration
@Slf4j
public class GoogleMeetConfig {

@Value("${google.credentials.file.path}")
private String credentialsFilePath;

@Value("${google.credentials.oauth2.callback.uri}")
private String callbackUri;

Expand Down Expand Up @@ -73,12 +71,8 @@ public void delete(String id) throws IOException {

@Bean
public UserAuthorizer userAuthorizer(TokenStore tokenStore) throws IOException {
log.info("credentials path: " + credentialsFilePath);
Path credentialsPath = Paths.get(credentialsFilePath);
if (!Files.exists(credentialsPath)) {
throw new CustomException(ErrorType.NOT_FOUND_CREDENTIALS_JSON_ERROR);
}
try (InputStream in = Files.newInputStream(credentialsPath)) {
ClassPathResource resource = new ClassPathResource("json/credentials.json");
try (InputStream in = resource.getInputStream()) {
ClientId clientId = ClientId.fromStream(in);
return UserAuthorizer.newBuilder()
.setClientId(clientId)
Expand Down

0 comments on commit 706b74c

Please sign in to comment.