diff --git a/build.gradle.kts b/build.gradle.kts index ce4ceb3d..2034697c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -316,3 +316,7 @@ koverReport { } } } + +springBoot { + buildInfo() +} diff --git a/src/main/kotlin/dev/usbharu/hideout/application/config/HttpClientConfig.kt b/src/main/kotlin/dev/usbharu/hideout/application/config/HttpClientConfig.kt index 6000f0a3..f3b036a1 100644 --- a/src/main/kotlin/dev/usbharu/hideout/application/config/HttpClientConfig.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/config/HttpClientConfig.kt @@ -2,15 +2,18 @@ package dev.usbharu.hideout.application.config import io.ktor.client.* import io.ktor.client.engine.cio.* +import io.ktor.client.plugins.* import io.ktor.client.plugins.cache.* import io.ktor.client.plugins.logging.* +import org.springframework.boot.info.BuildProperties import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration @Configuration class HttpClientConfig { @Bean - fun httpClient(): HttpClient = HttpClient(CIO).config { + fun httpClient(buildProperties: BuildProperties, applicationConfig: ApplicationConfig): HttpClient = + HttpClient(CIO).config { install(Logging) { logger = Logger.DEFAULT level = LogLevel.ALL @@ -18,5 +21,8 @@ class HttpClientConfig { install(HttpCache) { } expectSuccess = true - } + install(UserAgent) { + agent = "Hideout/${buildProperties.version} (${applicationConfig.url})" + } + } }