32 lines
1.2 KiB
Kotlin
32 lines
1.2 KiB
Kotlin
package kr.co.vividnext.sodalive.configs
|
|
|
|
import com.google.api.client.http.javanet.NetHttpTransport
|
|
import com.google.api.client.json.gson.GsonFactory
|
|
import com.google.api.services.androidpublisher.AndroidPublisher
|
|
import com.google.api.services.androidpublisher.AndroidPublisherScopes
|
|
import com.google.auth.http.HttpCredentialsAdapter
|
|
import com.google.auth.oauth2.GoogleCredentials
|
|
import org.springframework.beans.factory.annotation.Value
|
|
import org.springframework.context.annotation.Bean
|
|
import org.springframework.context.annotation.Configuration
|
|
import java.io.FileInputStream
|
|
|
|
@Configuration
|
|
class AndroidPublisherConfig(
|
|
@Value("\${firebase.secret-key-path}")
|
|
private val secretKeyPath: String
|
|
) {
|
|
@Bean
|
|
fun androidPublisher(): AndroidPublisher {
|
|
val jsonFactory = GsonFactory.getDefaultInstance()
|
|
val httpTransport = NetHttpTransport()
|
|
|
|
val credential = GoogleCredentials.fromStream(FileInputStream(secretKeyPath))
|
|
.createScoped(listOf(AndroidPublisherScopes.ANDROIDPUBLISHER))
|
|
|
|
return AndroidPublisher.Builder(httpTransport, jsonFactory, HttpCredentialsAdapter(credential))
|
|
.setApplicationName("소다라이브")
|
|
.build()
|
|
}
|
|
}
|