From cfaed70fe31598178e09889186174368e7cb9051 Mon Sep 17 00:00:00 2001 From: Evgeny Khramtsov Date: Fri, 14 Jun 2019 17:38:55 +0300 Subject: [PATCH] Warn about 'service_url' option during config transformation --- src/ejabberd_config_transformer.erl | 9 +++++++++ src/mod_http_upload.erl | 11 ++--------- src/mod_http_upload_opt.erl | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/ejabberd_config_transformer.erl b/src/ejabberd_config_transformer.erl index d76126e7e..693d86f1d 100644 --- a/src/ejabberd_config_transformer.erl +++ b/src/ejabberd_config_transformer.erl @@ -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}. diff --git a/src/mod_http_upload.erl b/src/mod_http_upload.erl index dc02bb11d..92185e30f 100644 --- a/src/mod_http_upload.erl +++ b/src/mod_http_upload.erl @@ -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>>}, diff --git a/src/mod_http_upload_opt.erl b/src/mod_http_upload_opt.erl index a985c229e..9c35b3c02 100644 --- a/src/mod_http_upload_opt.erl +++ b/src/mod_http_upload_opt.erl @@ -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) ->