fix(dynamo): use correct default port for different schemas
This commit is contained in:
parent
996d5eee45
commit
33c27ac2ac
|
@ -33,10 +33,6 @@
|
||||||
|
|
||||||
-import(hoconsc, [mk/2, enum/1, ref/2]).
|
-import(hoconsc, [mk/2, enum/1, ref/2]).
|
||||||
|
|
||||||
-define(DYNAMO_HOST_OPTIONS, #{
|
|
||||||
default_port => 80
|
|
||||||
}).
|
|
||||||
|
|
||||||
%%=====================================================================
|
%%=====================================================================
|
||||||
%% Hocon schema
|
%% Hocon schema
|
||||||
roots() ->
|
roots() ->
|
||||||
|
@ -84,8 +80,8 @@ on_start(
|
||||||
config => redact(Config)
|
config => redact(Config)
|
||||||
}),
|
}),
|
||||||
|
|
||||||
{Schema, Server} = get_host_schema(to_str(Url)),
|
{Schema, Server, DefaultPort} = get_host_info(to_str(Url)),
|
||||||
{Host, Port} = emqx_schema:parse_server(Server, ?DYNAMO_HOST_OPTIONS),
|
{Host, Port} = emqx_schema:parse_server(Server, #{default_port => DefaultPort}),
|
||||||
|
|
||||||
Options = [
|
Options = [
|
||||||
{config, #{
|
{config, #{
|
||||||
|
@ -226,12 +222,12 @@ to_str(List) when is_list(List) ->
|
||||||
to_str(Bin) when is_binary(Bin) ->
|
to_str(Bin) when is_binary(Bin) ->
|
||||||
erlang:binary_to_list(Bin).
|
erlang:binary_to_list(Bin).
|
||||||
|
|
||||||
get_host_schema("http://" ++ Server) ->
|
get_host_info("http://" ++ Server) ->
|
||||||
{"http://", Server};
|
{"http://", Server, 80};
|
||||||
get_host_schema("https://" ++ Server) ->
|
get_host_info("https://" ++ Server) ->
|
||||||
{"https://", Server};
|
{"https://", Server, 443};
|
||||||
get_host_schema(Server) ->
|
get_host_info(Server) ->
|
||||||
{"http://", Server}.
|
{"http://", Server, 80}.
|
||||||
|
|
||||||
redact(Data) ->
|
redact(Data) ->
|
||||||
emqx_utils:redact(Data, fun(Any) -> Any =:= aws_secret_access_key end).
|
emqx_utils:redact(Data, fun(Any) -> Any =:= aws_secret_access_key end).
|
||||||
|
|
Loading…
Reference in New Issue