25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

New command to reload config (EJAB-1140)

This commit is contained in:
Badlop 2015-01-21 15:18:46 +01:00
parent 120e581865
commit 15e77e9c0f
2 changed files with 18 additions and 1 deletions

View File

@ -31,6 +31,7 @@
status/0, reopen_log/0, status/0, reopen_log/0,
stop_kindly/2, send_service_message_all_mucs/2, stop_kindly/2, send_service_message_all_mucs/2,
registered_vhosts/0, registered_vhosts/0,
reload_config/0,
%% Erlang %% Erlang
update_list/0, update/1, update_list/0, update/1,
%% Accounts %% Accounts
@ -134,6 +135,11 @@ commands() ->
module = ?MODULE, function = registered_vhosts, module = ?MODULE, function = registered_vhosts,
args = [], args = [],
result = {vhosts, {list, {vhost, string}}}}, result = {vhosts, {list, {vhost, string}}}},
#ejabberd_commands{name = reload_config, tags = [server],
desc = "Reload ejabberd configuration file into memory",
module = ?MODULE, function = reload_config,
args = [],
result = {res, rescode}},
#ejabberd_commands{name = import_file, tags = [mnesia], #ejabberd_commands{name = import_file, tags = [mnesia],
desc = "Import user data from jabberd14 spool file", desc = "Import user data from jabberd14 spool file",
@ -352,6 +358,11 @@ registered_users(Host) ->
registered_vhosts() -> registered_vhosts() ->
?MYHOSTS. ?MYHOSTS.
reload_config() ->
ejabberd_config:reload_file(),
acl:start(),
shaper:start().
%%% %%%
%%% Migration management %%% Migration management
%%% %%%

View File

@ -26,7 +26,7 @@
-module(ejabberd_config). -module(ejabberd_config).
-author('alexey@process-one.net'). -author('alexey@process-one.net').
-export([start/0, load_file/1, read_file/1, -export([start/0, load_file/1, reload_file/0, read_file/1,
add_global_option/2, add_local_option/2, add_global_option/2, add_local_option/2,
get_global_option/2, get_local_option/2, get_global_option/2, get_local_option/2,
get_global_option/3, get_local_option/3, get_global_option/3, get_local_option/3,
@ -125,6 +125,12 @@ load_file(File) ->
State = read_file(File), State = read_file(File),
set_opts(State). set_opts(State).
-spec reload_file() -> ok.
reload_file() ->
Config = get_ejabberd_config_path(),
load_file(Config).
-spec convert_to_yaml(file:filename()) -> ok | {error, any()}. -spec convert_to_yaml(file:filename()) -> ok | {error, any()}.
convert_to_yaml(File) -> convert_to_yaml(File) ->