diff --git a/pom.xml b/pom.xml index 7fb0094..50217ac 100644 --- a/pom.xml +++ b/pom.xml @@ -99,6 +99,11 @@ org.springframework.boot spring-boot-starter-data-redis + + redis.clients + jedis + 4.3.2 + org.apache.commons commons-pool2 diff --git a/src/main/kotlin/no/nav/arbeidsgiver/altinnrettigheter/proxy/config/RedisConfig.kt b/src/main/kotlin/no/nav/arbeidsgiver/altinnrettigheter/proxy/config/RedisConfig.kt index 41fbd8d..a38c117 100644 --- a/src/main/kotlin/no/nav/arbeidsgiver/altinnrettigheter/proxy/config/RedisConfig.kt +++ b/src/main/kotlin/no/nav/arbeidsgiver/altinnrettigheter/proxy/config/RedisConfig.kt @@ -1,13 +1,13 @@ package no.nav.arbeidsgiver.altinnrettigheter.proxy.config -import io.lettuce.core.RedisURI import org.springframework.beans.factory.annotation.Value -import org.springframework.boot.autoconfigure.data.redis.LettuceClientConfigurationBuilderCustomizer import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.data.redis.connection.RedisStandaloneConfiguration +import org.springframework.data.redis.connection.jedis.JedisConnectionFactory import java.net.URI + @Configuration class RedisConfig { @@ -16,7 +16,7 @@ class RedisConfig { * nais exposes url, username and password, but RedisURI expects usename and password to be part of the url * https://lettuce.io/core/release/api/io/lettuce/core/RedisURI.html * - * see also org.springframework.boot.autoconfigure.data.redis.RedisProperties.url which says + * see org.springframework.boot.autoconfigure.data.redis.RedisProperties.url which says * "Connection URL. Overrides host, port, and password. User is ignored. Example: redis://user:password@example.com:6379" */ @Bean @@ -33,12 +33,5 @@ class RedisConfig { } @Bean - fun lettuceClientConfigurationCustomizer( - @Value("\${spring.data.redis.url}") redisUrl: URI, - ) = LettuceClientConfigurationBuilderCustomizer { - it.apply(RedisURI.create(redisUrl).apply { - // TODO: dont do this in prod - isVerifyPeer = false - }) - } + fun redisConnectionFactory(config: RedisStandaloneConfiguration) = JedisConnectionFactory(config) } \ No newline at end of file diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 83ac369..cea2e33 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -5,11 +5,13 @@ spring: banner-mode: off data: redis: + client-type: jedis password: ${REDIS_PASSWORD_ALTINNRETTIGHETER:} username: ${REDIS_USERNAME_ALTINNRETTIGHETER:} url: ${REDIS_URI_ALTINNRETTIGHETER:redis://127.0.0.1:6379} + ssl: true timeout: 2000 - lettuce: + jedis: pool: max-active: 16 min-idle: 8