mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
Allow writing custom modules in own path (#1327)
in ejabberdctl, just add this to EJABBERD_OPTS external_beams /path/to/my/beams then all beams file /path/to/my/beams/*.beam will be known by ejabberd_config, and allowed to be loaded.
This commit is contained in:
parent
44700d91ba
commit
00e32ee4b6
@ -978,7 +978,19 @@ default_db(Opt, Host, Module) ->
|
||||
get_modules() ->
|
||||
{ok, Mods} = application:get_key(ejabberd, modules),
|
||||
ExtMods = [Name || {Name, _Details} <- ext_mod:installed()],
|
||||
ExtMods ++ Mods.
|
||||
case application:get_env(ejabberd, external_beams) of
|
||||
{ok, Path} ->
|
||||
case lists:member(Path, code:get_path()) of
|
||||
true -> ok;
|
||||
false -> code:add_patha(Path)
|
||||
end,
|
||||
Beams = filelib:wildcard(filename:join(Path, "*\.beam")),
|
||||
CustMods = [list_to_atom(filename:rootname(filename:basename(Beam)))
|
||||
|| Beam <- Beams],
|
||||
CustMods ++ ExtMods ++ Mods;
|
||||
_ ->
|
||||
ExtMods ++ Mods
|
||||
end.
|
||||
|
||||
get_modules_with_options(Modules) ->
|
||||
lists:foldl(
|
||||
|
Loading…
Reference in New Issue
Block a user