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

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

Open
Foboz opened this issue Mar 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Foboz
Copy link

Foboz commented Mar 19, 2024

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

@Foboz Foboz added the bug Something isn't working label Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant