File tree Expand file tree Collapse file tree 4 files changed +15
-6
lines changed
src/main/kotlin/dev/slne/redis Expand file tree Collapse file tree 4 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -162,7 +162,11 @@ class RedisApi private constructor(
162162 require(isFrozen()) { " Redis client must be frozen before connecting" }
163163 require(! isConnected()) { " Redis client already initialized" }
164164
165- val redisURI = RedisURI .create(config.host, config.port)
165+ val redisURI = RedisURI .builder().apply {
166+ withHost(config.host)
167+ withPort(config.port)
168+ config.password?.let { withPassword(it) }
169+ }.build()
166170 redisClient = RedisClient .create(redisURI)
167171
168172 connection = redisClient.connect()
Original file line number Diff line number Diff line change @@ -9,12 +9,14 @@ import kotlin.io.path.div
99@ConfigSerializable
1010internal data class GlobalConfig (
1111 val host : String = " localhost" ,
12- val port : Int = 6379
12+ val port : Int = 6379 ,
13+ val password : String? = null
1314) {
1415
1516 fun toInternal () = InternalConfig (
1617 host = host,
17- port = port
18+ port = port,
19+ password = password
1820 )
1921
2022 companion object {
Original file line number Diff line number Diff line change @@ -4,7 +4,8 @@ import java.nio.file.Path
44
55internal data class InternalConfig (
66 val host : String = " localhost" ,
7- val port : Int = 6379
7+ val port : Int = 6379 ,
8+ val password : String? = null
89) {
910
1011 companion object {
Original file line number Diff line number Diff line change @@ -14,12 +14,14 @@ internal data class LocalConfig(
1414 @ConfigSerializable
1515 data class Local (
1616 val host : String = " localhost" ,
17- val port : Int = 6379
17+ val port : Int = 6379 ,
18+ val password : String? = null
1819 )
1920
2021 fun toInternal () = InternalConfig (
2122 host = local.host,
22- port = local.port
23+ port = local.port,
24+ password = local.password
2325 )
2426
2527 companion object {
You can’t perform that action at this time.
0 commit comments