Genie.jl
Genie.jl copied to clipboard
Genie ignores server_host in settings.
Background
I've been trying for hours to get my genie site (run in a docker container) to load on my host machine. The issue is Genie keeps trying to bind to 127.0.0.1 even though I tell it to bind to 0.0.0.0.
Environment
julia 1.6.0 Genie v3.0.0
What I expect
If I don't set the HOST environmental variable, I expect server_host to be set by the configuration in config/env/*.jl.
What happens instead
Genie instead does some internal config, overwriting the user's choice:
Genie.jl: lines 246:248
if !haskey(ENV, "HOST")
ENV["HOST"] = (ENV["GENIE_ENV"] == "dev") ? "127.0.0.1" : "0.0.0.0"
end
Effect
This results in my server only listening to requests from inside the same docker container, rather than from my host.
Request
Can this logic be taken out and can we respect the actual configuration (the config/env/* files and the environmental variables: It's still not quite clear to me which takes priority, but I'd like to learn that too)?
Thanks - yes, that's how it was (supposed to be) working. I confirm the issue. I'll look into it ASAP.
I just triggered the registration of v3.2.0 which should address this. Please try once it's released and lmk. Thanks.
Great! Thanks so much for your fast response. :)
BTW, if both an ENV variable and a config value is set, which is supposed to take priority? Is that documented anywhere?
Defo ENV should be prioritized since it's the only way to dynamically overwrite what's written in config. Passing an ENV value is an explicit act of setting a ad-hoc configuration param and users expect to see it applied (otherwise why bother adding it).
Don't think it's documented - defo should be. And we should also have tests covering the various ENV+config scenarios.
Ok. Thank you. :)
On Wed, Sep 29, 2021 at 9:10 PM Adrian Salceanu @.***> wrote:
Don't think it's documented - defo should be. And we should also have tests covering the various ENV+config scenarios.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/GenieFramework/Genie.jl/issues/417#issuecomment-930161022, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEVLQ5UYSL7P5OKOIIIPD6DUEMF5TANCNFSM5EZRFUOA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.