-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
weird behaviour when deep merging endpoint options #5758
Comments
The tricky thing here is that the I feel pretty strongly that Thousand Island should expose the exact same interface for configuration as the underlying transport does (that is, I really don't want to be in the business of rewriting people's configurations as it's a never-ending treadmill of special cases). Unsure of the best way to resolve this, TBH. Open to options! |
Environment
Actual behavior
Phoenix endpoint supports providing options overrides via the
start_link
argument. Suppose that in runtime.exs we have the following:And then we use the childspec
{MyEndpoint, http: [transport_options: [socket_opts: [debug: true]]]}
.The final configuration will be:
socket_opts: [:inet6]
. I.e. the providedsocket_opts
override was ignored.OTOH, if
socket_opts
in the config is a keyword list, merging will succeed, and the finalsocket_opts
will be a result of merging both kw lists. In this case, thesocket_opts
list passed tostart_link
will take precedence (i.e. it will overwrite the values with the same keys from app env).example script
Expected behavior
Not sure :-)
Ideally, two
socket_opts
lists would be merged, but I understand that this is a tricky decision which might cause implicit issues in other places.If there's no merging, then I'd at least expect the option passed to
start_link
to take precedence, i.e. to overwrite the one from the app env. Because that's how it behaves when both values are proper kw lists.Yet another option is to warn/error, but I'm not sure this is a good idea in general.
The text was updated successfully, but these errors were encountered: