mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-30 16:36:29 +01:00
When installing module already configured, keep config as example
When installing a module using ext_mod, if it has already configuration in the modules section, copy its specific config file as an example (copy file and rename it). This may happen when using the new install_contrib_modules option.
This commit is contained in:
parent
c9a2117570
commit
436074c67a
@ -676,15 +676,22 @@ inform_module_configuration(Module, LibDir, Files1) ->
|
|||||||
Res = lists:filter(fun({[$c, $o, $n, $f |_], ok}) -> true;
|
Res = lists:filter(fun({[$c, $o, $n, $f |_], ok}) -> true;
|
||||||
(_) -> false
|
(_) -> false
|
||||||
end, Files1),
|
end, Files1),
|
||||||
case Res of
|
AlreadyConfigured = lists:keymember(Module, 1, ejabberd_config:get_option(modules)),
|
||||||
[{ConfigPath, ok}] ->
|
case {Res, AlreadyConfigured} of
|
||||||
|
{[{ConfigPath, ok}], false} ->
|
||||||
FullConfigPath = filename:join(LibDir, ConfigPath),
|
FullConfigPath = filename:join(LibDir, ConfigPath),
|
||||||
io:format("Module ~p has been installed and started.~n"
|
io:format("Module ~p has been installed and started.~n"
|
||||||
"It's configured in the file:~n ~s~n"
|
"It's configured in the file:~n ~s~n"
|
||||||
"Configure the module in that file, or remove it~n"
|
"Configure the module in that file, or remove it~n"
|
||||||
"and configure in your main ejabberd.yml~n",
|
"and configure in your main ejabberd.yml~n",
|
||||||
[Module, FullConfigPath]);
|
[Module, FullConfigPath]);
|
||||||
[] ->
|
{[{ConfigPath, ok}], true} ->
|
||||||
|
FullConfigPath = filename:join(LibDir, ConfigPath),
|
||||||
|
file:rename(FullConfigPath, FullConfigPath++".example"),
|
||||||
|
io:format("Module ~p has been installed and started.~n"
|
||||||
|
"The ~p configuration in your ejabberd.yml is used.~n",
|
||||||
|
[Module, Module]);
|
||||||
|
{[], _} ->
|
||||||
io:format("Module ~p has been installed.~n"
|
io:format("Module ~p has been installed.~n"
|
||||||
"Now you can configure it in your ejabberd.yml~n",
|
"Now you can configure it in your ejabberd.yml~n",
|
||||||
[Module])
|
[Module])
|
||||||
|
Loading…
Reference in New Issue
Block a user