Skip to content

Commit

Permalink
Add a default for pool scope
Browse files Browse the repository at this point in the history
  • Loading branch information
gustawlippa committed Feb 17, 2022
1 parent 9f7d17d commit f1bc241
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/config/mongoose_config_spec.erl
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ outgoing_pool(Type) ->
process = fun ?MODULE:process_pool/2,
format_items = map,
wrap = item,
defaults = wpool_defaults(Type)
defaults = maps:merge(#{<<"scope">> => global}, wpool_defaults(Type))
}.

wpool_items() ->
Expand Down Expand Up @@ -1196,8 +1196,8 @@ check_auth_method(Method, Opts) ->
false -> error(#{what => missing_section_for_auth_method, auth_method => Method})
end.

process_pool([Tag, Type|_], AllOpts) ->
Scope = pool_scope(maps:get(scope, AllOpts, none), maps:get(host, AllOpts, none)),
process_pool([Tag, Type|_], AllOpts = #{scope := ScopeIn}) ->
Scope = pool_scope(ScopeIn, maps:get(host, AllOpts, none)),
Connection = maps:get(connection, AllOpts, #{}),
Opts = maps:without([scope, host, connection], AllOpts),
#{type => b2a(Type),
Expand All @@ -1211,8 +1211,7 @@ pool_scope(single_host, none) ->
text => <<"\"host\" option is required if \"single_host\" is used.">>});
pool_scope(single_host, Host) -> Host;
pool_scope(host, none) -> host;
pool_scope(global, none) -> global;
pool_scope(none, none) -> global.
pool_scope(global, none) -> global.

process_cassandra_server(KVs) ->
{[[{ip_address, IPAddr}]], Opts} = proplists:split(KVs, [ip_address]),
Expand Down

0 comments on commit f1bc241

Please sign in to comment.