Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis configuration provider #215

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
F added new factory member to redisConfiguration, this is going to be…
… used from RedisStorage on bootstrap

F added computed property in order to retrieve factory based on current configuration
apemaia99 committed May 12, 2024
commit bb825b5dbc3d86256bc9ee56f940fb120e43862c
6 changes: 6 additions & 0 deletions Sources/Redis/Configuration/RedisConfiguration.swift
Original file line number Diff line number Diff line change
@@ -15,6 +15,11 @@ public struct RedisConfiguration {
public let tlsConfiguration: TLSConfiguration?
public let tlsHostname: String?

let factory: RedisFactory.Type
var provider: RedisFactory {
factory.init(configuration: self)
}

public init(url string: String, tlsConfiguration: TLSConfiguration? = nil, pool: PoolOptions = .init()) throws {
guard let url = URL(string: string) else { throw ValidationError.invalidURLString }
try self.init(url: url, tlsConfiguration: tlsConfiguration, pool: pool)
@@ -83,5 +88,6 @@ public struct RedisConfiguration {
self.tlsHostname = tlsHostname
self.database = database
self.pool = pool
factory = RedisProvider.self
}
}