1
0
Fork 0
mirror of https://github.com/processone/ejabberd synced 2025-10-03 17:59:31 +02:00

ejabberd_config: Improve warning message about unsupported ram_db type

This commit is contained in:
Badlop 2025-07-18 12:58:25 +02:00
parent 214b76f763
commit d269e32c3a

View file

@ -264,30 +264,31 @@ version() ->
-spec default_db(binary() | global, module()) -> atom(). -spec default_db(binary() | global, module()) -> atom().
default_db(Host, Module) -> default_db(Host, Module) ->
default_db(default_db, Host, Module, mnesia). default_db(default_db, db_type, Host, Module, mnesia).
-spec default_db(binary() | global, module(), atom()) -> atom(). -spec default_db(binary() | global, module(), atom()) -> atom().
default_db(Host, Module, Default) -> default_db(Host, Module, Default) ->
default_db(default_db, Host, Module, Default). default_db(default_db, db_type, Host, Module, Default).
-spec default_ram_db(binary() | global, module()) -> atom(). -spec default_ram_db(binary() | global, module()) -> atom().
default_ram_db(Host, Module) -> default_ram_db(Host, Module) ->
default_db(default_ram_db, Host, Module, mnesia). default_db(default_ram_db, ram_db_type, Host, Module, mnesia).
-spec default_ram_db(binary() | global, module(), atom()) -> atom(). -spec default_ram_db(binary() | global, module(), atom()) -> atom().
default_ram_db(Host, Module, Default) -> default_ram_db(Host, Module, Default) ->
default_db(default_ram_db, Host, Module, Default). default_db(default_ram_db, ram_db_type, Host, Module, Default).
-spec default_db(default_db | default_ram_db, binary() | global, module(), atom()) -> atom(). -spec default_db(default_db | default_ram_db, db_type | ram_db_type, binary() | global, module(), atom()) -> atom().
default_db(Opt, Host, Mod, Default) -> default_db(Opt, ModOpt, Host, Mod, Default) ->
Type = get_option({Opt, Host}), Type = get_option({Opt, Host}),
DBMod = list_to_atom(atom_to_list(Mod) ++ "_" ++ atom_to_list(Type)), DBMod = list_to_atom(atom_to_list(Mod) ++ "_" ++ atom_to_list(Type)),
case code:ensure_loaded(DBMod) of case code:ensure_loaded(DBMod) of
{module, _} -> Type; {module, _} -> Type;
{error, _} -> {error, _} ->
?WARNING_MSG("Module ~ts doesn't support database '~ts' " ?WARNING_MSG("Module ~ts doesn't support database '~ts' "
"defined in option '~ts', using " "defined in toplevel option '~ts': will use the value "
"'~ts' as fallback", [Mod, Type, Opt, Default]), "set in ~ts option '~ts', or '~ts' as fallback",
[Mod, Type, Opt, Mod, ModOpt, Default]),
Default Default
end. end.