You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 provided socket_opts override was ignored.
OTOH, if socket_opts in the config is a keyword list, merging will succeed, and the final socket_opts will be a result of merging both kw lists. In this case, the socket_opts list passed to start_link will take precedence (i.e. it will overwrite the values with the same keys from app env).
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:
The tricky thing here is that the transport_opts list (which gets passed more or less directly to the underlying transport; either :gen_tcp or :ssl) isn't a keyword list, it's a proplist. Moreover, :gen_tcp and :ssl don't use the 'first value wins' semantic for duplicate entries in this list, which makes merging an explicit affair. See mtrudel/thousand_island#113 and mtrudel/thousand_island#111 for details.
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: