vapor / redis

Vapor provider for RediStack

Repository from Github https://github.comvapor/redisRepository from Github https://github.comvapor/redis

Impossible to configure redis, if redis host name is unknown on time of launch

Foboz opened this issue · comments

Describe the issue

NIOCore.SocketAddressError.unknown from configuration

Vapor version

4.92.4

Operating system and version

Ubuntu Linux 22.04

Swift version

Swift 5.9

Steps to reproduce

We have a setup with docker-compose where redis is not mandatory or might start after vapor app, so network alias redis can't be resolved on time of vapor app starts, so that:

let configuration = try RedisConfiguration(url: "redis://redis:6379")

will fail with an error:

NIOCore.SocketAddressError.unknown(host: "redis", port: 6379)

which is happening here:

serverAddresses: [.makeAddressResolvingHost(hostname, port: port)],

but actually here: https://github.com/apple/swift-nio/blob/1e2b3e34afee7d68d99d982b72f9a17a40624c66/Sources/NIOCore/SocketAddresses.swift#L490

so, no configuration can be set and due to internal logic around boot() it's not possible to configure Redis later on, once redis name can be resolved

Outcome

No response

Additional notes

No response