Replacing the for loop with this works ![]()
for {scheme, default_port} <- [http: 4000, https: 4040],
opts = config[scheme],
port <- :proplists.get_all_values(:port, opts) do
{opts, port} =
cond do
is_list(port) ->
port_ = :proplists.get_value(:port, port, default_port)
opts_ = Keyword.merge(opts, port, fn _key, _v1, v2 -> v2 end)
{opts_, port_}
true ->
{opts, port}
end
This requires me to write the config likes this:
...
http: [ip: {127, 0 ,0 1}, port: 4000, port: [ port: 5000, protocol_options: [ proxy_header: true ]]],
https: [port: 4040, port: [ port: 5050, protocol_options: [ proxy_header: true ]]],
The options given in the port keyword list will be merged in the original, overwriting any existing.






















