File tree Expand file tree Collapse file tree
kotlin/com/letsrecordit/letsrecorditimageserver/config/gcp Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package com.letsrecordit.letsrecorditimageserver.config.gcp
22
3- import com.google.auth.oauth2.GoogleCredentials
43import com.google.cloud.storage.Storage
54import com.google.cloud.storage.StorageOptions
6- import org.springframework.beans.factory.annotation.Value
75import org.springframework.context.annotation.Bean
86import org.springframework.context.annotation.Configuration
97import org.springframework.context.annotation.Profile
10- import org.springframework.util.ResourceUtils
118
129@Configuration
1310@Profile(" !test" )
14- class GCSConfig (
15- @Value(" \$ {spring.cloud.gcp.storage.credentials.location}" )
16- private val keyFileName : String ,
17- ) {
11+ class GCSConfig () {
1812
1913 @Bean
2014 fun storage (): Storage {
21- val keyFile = ResourceUtils .getURL(keyFileName).openStream()
22-
23- return StorageOptions .newBuilder()
24- .setCredentials(GoogleCredentials .fromStream(keyFile))
25- .build()
26- .service
15+ return StorageOptions .getDefaultInstance().service;
2716 }
2817}
Original file line number Diff line number Diff line change @@ -13,8 +13,6 @@ spring:
1313 cloud :
1414 gcp :
1515 storage :
16- credentials :
17- location : ${GCP_CREDENTIAL_LOCATION}
1816 project-id : ${GCP_PROJECT_ID}
1917 bucket : ${GCP_BUCKET_NAME}
2018
Original file line number Diff line number Diff line change @@ -14,8 +14,6 @@ spring:
1414 cloud :
1515 gcp :
1616 storage :
17- credentials :
18- location : ${GCP_CREDENTIAL_LOCATION}
1917 project-id : ${GCP_PROJECT_ID}
2018 bucket : ${GCP_BUCKET_NAME}
2119
You can’t perform that action at this time.
0 commit comments