summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ejabberd.yml.example9
-rw-r--r--src/ejabberd_http.erl37
2 files changed, 37 insertions, 9 deletions
diff --git a/ejabberd.yml.example b/ejabberd.yml.example
index 52a9c9f6..e62dd8bc 100644
--- a/ejabberd.yml.example
+++ b/ejabberd.yml.example
@@ -57,19 +57,20 @@ listen:
port: 5443
ip: "::"
module: ejabberd_http
+ tls: true
request_handlers:
+ "/admin": ejabberd_web_admin
"/api": mod_http_api
"/bosh": mod_bosh
+ "/captcha": ejabberd_captcha
"/upload": mod_http_upload
"/ws": ejabberd_http_ws
- web_admin: true
- captcha: true
- tls: true
-
port: 5280
ip: "::"
module: ejabberd_http
- web_admin: true
+ request_handlers:
+ "/admin": ejabberd_web_admin
-
port: 1883
ip: "::"
diff --git a/src/ejabberd_http.erl b/src/ejabberd_http.erl
index d9e13132..29d23e08 100644
--- a/src/ejabberd_http.erl
+++ b/src/ejabberd_http.erl
@@ -983,6 +983,18 @@ prepare_request_module(Mod) when is_atom(Mod) ->
erlang:error(Err)
end.
+emit_option_replacement(Option, Path, Handler) ->
+ ?WARNING_MSG(
+ "Listening option '~s' is deprecated, enable it via request handlers, e.g.:~n"
+ "listen:~n"
+ " ...~n"
+ " -~n"
+ " module: ~s~n"
+ " request_handlers:~n"
+ " ...~n"
+ " \"~s\": ~s~n",
+ [Option, ?MODULE, Path, Handler]).
+
-spec opt_type(atom()) -> fun((any()) -> any()) | [atom()].
opt_type(trusted_proxies) ->
fun (all) -> all;
@@ -1004,15 +1016,30 @@ listen_opt_type(certfile = Opt) ->
File
end;
listen_opt_type(captcha) ->
- fun(B) when is_boolean(B) -> B end;
+ fun(B) when is_boolean(B) ->
+ emit_option_replacement(captcha, "/captcha", ejabberd_captcha),
+ B
+ end;
listen_opt_type(register) ->
- fun(B) when is_boolean(B) -> B end;
+ fun(B) when is_boolean(B) ->
+ emit_option_replacement(register, "/register", mod_register_web),
+ B
+ end;
listen_opt_type(web_admin) ->
- fun(B) when is_boolean(B) -> B end;
+ fun(B) when is_boolean(B) ->
+ emit_option_replacement(web_admin, "/admin", ejabberd_web_admin),
+ B
+ end;
listen_opt_type(http_bind) ->
- fun(B) when is_boolean(B) -> B end;
+ fun(B) when is_boolean(B) ->
+ emit_option_replacement(http_bind, "/bosh", mod_bosh),
+ B
+ end;
listen_opt_type(xmlrpc) ->
- fun(B) when is_boolean(B) -> B end;
+ fun(B) when is_boolean(B) ->
+ emit_option_replacement(xmlrpc, "/", ejabberd_xmlrpc),
+ B
+ end;
listen_opt_type(tag) ->
fun(B) when is_binary(B) -> B end;
listen_opt_type(request_handlers) ->