테스트 통합 환경 설정 추가
This commit is contained in:
@@ -14,17 +14,24 @@ import java.io.FileInputStream
|
||||
@Configuration
|
||||
class AndroidPublisherConfig(
|
||||
@Value("\${firebase.secret-key-path}")
|
||||
private val secretKeyPath: String
|
||||
private val secretKeyPath: String,
|
||||
@Value("\${android-publisher.enabled:true}")
|
||||
private val enabled: Boolean
|
||||
) {
|
||||
@Bean
|
||||
fun androidPublisher(): AndroidPublisher {
|
||||
val jsonFactory = GsonFactory.getDefaultInstance()
|
||||
val httpTransport = NetHttpTransport()
|
||||
val credential = if (enabled) {
|
||||
HttpCredentialsAdapter(
|
||||
GoogleCredentials.fromStream(FileInputStream(secretKeyPath))
|
||||
.createScoped(listOf(AndroidPublisherScopes.ANDROIDPUBLISHER))
|
||||
)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
val credential = GoogleCredentials.fromStream(FileInputStream(secretKeyPath))
|
||||
.createScoped(listOf(AndroidPublisherScopes.ANDROIDPUBLISHER))
|
||||
|
||||
return AndroidPublisher.Builder(httpTransport, jsonFactory, HttpCredentialsAdapter(credential))
|
||||
return AndroidPublisher.Builder(httpTransport, jsonFactory, credential)
|
||||
.setApplicationName("소다라이브")
|
||||
.build()
|
||||
}
|
||||
|
||||
@@ -4,11 +4,13 @@ import com.google.auth.oauth2.GoogleCredentials
|
||||
import com.google.firebase.FirebaseApp
|
||||
import com.google.firebase.FirebaseOptions
|
||||
import org.springframework.beans.factory.annotation.Value
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import java.io.FileInputStream
|
||||
import javax.annotation.PostConstruct
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnProperty(name = ["firebase.enabled"], havingValue = "true", matchIfMissing = true)
|
||||
class FirebaseConfig(
|
||||
@Value("\${firebase.secret-key-path}")
|
||||
private val secretKeyPath: String
|
||||
|
||||
@@ -27,15 +27,17 @@ class RedisConfig(
|
||||
@Value("\${spring.redis.host}")
|
||||
private val host: String,
|
||||
@Value("\${spring.redis.port}")
|
||||
private val port: Int
|
||||
private val port: Int,
|
||||
@Value("\${spring.redis.ssl-enabled:true}")
|
||||
private val sslEnabled: Boolean
|
||||
) {
|
||||
@Bean(destroyMethod = "shutdown")
|
||||
fun redissonClient(): RedissonClient {
|
||||
val config = Config()
|
||||
val scheme = if (sslEnabled) "rediss" else "redis"
|
||||
config.useSingleServer()
|
||||
.setAddress("rediss://$host:$port")
|
||||
.setSslEnableEndpointIdentification(true)
|
||||
.setSslTruststore(null)
|
||||
.setAddress("$scheme://$host:$port")
|
||||
.setSslEnableEndpointIdentification(sslEnabled)
|
||||
.setDnsMonitoringInterval(30000)
|
||||
.setConnectionMinimumIdleSize(0)
|
||||
.setConnectionPoolSize(5)
|
||||
@@ -44,12 +46,14 @@ class RedisConfig(
|
||||
|
||||
@Bean
|
||||
fun redisConnectionFactory(): RedisConnectionFactory {
|
||||
val clientConfiguration = LettuceClientConfiguration.builder()
|
||||
.useSsl()
|
||||
.disablePeerVerification()
|
||||
.build()
|
||||
val clientConfigurationBuilder = LettuceClientConfiguration.builder()
|
||||
if (sslEnabled) {
|
||||
clientConfigurationBuilder
|
||||
.useSsl()
|
||||
.disablePeerVerification()
|
||||
}
|
||||
|
||||
return LettuceConnectionFactory(RedisStandaloneConfiguration(host, port), clientConfiguration)
|
||||
return LettuceConnectionFactory(RedisStandaloneConfiguration(host, port), clientConfigurationBuilder.build())
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
Reference in New Issue
Block a user