From 7cbf7025b160e8b18f51e661c89df1855f2476d9 Mon Sep 17 00:00:00 2001 From: Anton Fofanov Date: Wed, 28 Aug 2024 17:04:51 +0200 Subject: [PATCH] =?UTF-8?q?PEK-519=20bruk=20ulike=20clienter=20for=20selve?= =?UTF-8?q?=20simulering=20avhengig=20av=20milj=C3=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tjenestepensjon/simulering/config/WebClientConfig.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/kotlin/no/nav/tjenestepensjon/simulering/config/WebClientConfig.kt b/src/main/kotlin/no/nav/tjenestepensjon/simulering/config/WebClientConfig.kt index 2b508b11..722dc19d 100644 --- a/src/main/kotlin/no/nav/tjenestepensjon/simulering/config/WebClientConfig.kt +++ b/src/main/kotlin/no/nav/tjenestepensjon/simulering/config/WebClientConfig.kt @@ -12,6 +12,7 @@ import org.slf4j.MDC import org.springframework.beans.factory.annotation.Value import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.context.annotation.Profile import org.springframework.http.MediaType import org.springframework.http.client.reactive.ReactorClientHttpConnector import org.springframework.web.reactive.function.client.ClientRequest @@ -24,11 +25,18 @@ import reactor.netty.http.client.HttpClient @Configuration class WebClientConfig { + @Profile(value = ["prod", "preprod"]) @Bean fun httpClient(): HttpClient = HttpClient.create().proxyWithSystemProperties().option(ChannelOption.CONNECT_TIMEOUT_MILLIS, CONNECT_TIMEOUT_MILLIS) .doOnConnected { it.addHandlerLast(ReadTimeoutHandler(READ_TIMEOUT_MILLIS / 1000)) } + @Profile(value = ["prod-gcp", "dev-gcp"]) + @Bean + fun client(): HttpClient = + HttpClient.create().option(ChannelOption.CONNECT_TIMEOUT_MILLIS, CONNECT_TIMEOUT_MILLIS) + .doOnConnected { it.addHandlerLast(ReadTimeoutHandler(READ_TIMEOUT_MILLIS / 1000)) } + @Bean fun webClient(httpClient: HttpClient): WebClient = WebClient.builder().clientConnector(ReactorClientHttpConnector(httpClient))