25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

Warn about 'service_url' option during config transformation

This commit is contained in:
Evgeny Khramtsov 2019-06-14 17:38:55 +03:00
parent 9e2e590061
commit cfaed70fe3
3 changed files with 12 additions and 10 deletions

View File

@ -398,6 +398,15 @@ transform_module(_Host, mod_http_api, Opts, Acc) ->
true
end, Opts),
{{mod_http_api, Opts1}, Acc};
transform_module(_Host, mod_http_upload, Opts, Acc) ->
Opts1 = lists:filter(
fun({service_url, _}) ->
warn_deprecated_option(service_url, external_secret),
true;
(_) ->
true
end, Opts),
{{mod_http_upload, Opts1}, Acc};
transform_module(_Host, Mod, Opts, Acc) ->
{{Mod, Opts}, Acc}.

View File

@ -174,13 +174,7 @@ mod_opt_type(put_url) ->
mod_opt_type(get_url) ->
econf:url();
mod_opt_type(service_url) ->
econf:and_then(
econf:url(),
fun(URL) ->
?WARNING_MSG("Option 'service_url' is deprecated, consider using "
"the 'external_secret' interface instead", []),
URL
end);
econf:url();
mod_opt_type(custom_headers) ->
econf:map(econf:binary(), econf:binary());
mod_opt_type(rm_on_unregister) ->
@ -203,8 +197,7 @@ mod_opt_type(host) ->
mod_opt_type(hosts) ->
econf:well_known(hosts, ?MODULE).
-spec mod_options(binary()) -> [{service_url, binary()} |
{thumbnail, boolean()} |
-spec mod_options(binary()) -> [{thumbnail, boolean()} |
{atom(), any()}].
mod_options(Host) ->
[{host, <<"upload.", Host/binary>>},

View File

@ -111,7 +111,7 @@ secret_length(Opts) when is_map(Opts) ->
secret_length(Host) ->
gen_mod:get_module_opt(Host, mod_http_upload, secret_length).
-spec service_url(gen_mod:opts() | global | binary()) -> binary().
-spec service_url(gen_mod:opts() | global | binary()) -> 'undefined' | binary().
service_url(Opts) when is_map(Opts) ->
gen_mod:get_opt(service_url, Opts);
service_url(Host) ->