summaryrefslogtreecommitdiff
path: root/src/ejabberd_config.erl
diff options
context:
space:
mode:
authorPaweł Chmielowski <pchmielowski@process-one.net>2016-11-04 12:57:57 +0100
committerPaweł Chmielowski <pchmielowski@process-one.net>2016-11-04 12:58:08 +0100
commit62db0309421b9152361aa946c6b9319b8274edd4 (patch)
tree2db77224c290d02909a95c897ec2842b3b03e1f5 /src/ejabberd_config.erl
parentAppend ; to privacy_list_data exporting lines (thanks to Marcio Luciano Donada) (diff)
Merge mod_opt_type from db sub-modules to main module mod_opt_type
Diffstat (limited to 'src/ejabberd_config.erl')
-rw-r--r--src/ejabberd_config.erl33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/ejabberd_config.erl b/src/ejabberd_config.erl
index 517f2fd2..af26767f 100644
--- a/src/ejabberd_config.erl
+++ b/src/ejabberd_config.erl
@@ -29,16 +29,16 @@
-export([start/0, load_file/1, reload_file/0, read_file/1,
add_global_option/2, add_local_option/2,
get_global_option/2, get_local_option/2,
- get_global_option/3, get_local_option/3,
- get_option/2, get_option/3, add_option/2, has_option/1,
- get_vh_by_auth_method/1, is_file_readable/1,
- get_version/0, get_myhosts/0, get_mylang/0,
- get_ejabberd_config_path/0, is_using_elixir_config/0,
- prepare_opt_val/4, convert_table_to_binary/5,
- transform_options/1, collect_options/1, default_db/2,
- convert_to_yaml/1, convert_to_yaml/2, v_db/2,
- env_binary_to_list/2, opt_type/1, may_hide_data/1,
- is_elixir_enabled/0]).
+ get_global_option/3, get_local_option/3,
+ get_option/2, get_option/3, add_option/2, has_option/1,
+ get_vh_by_auth_method/1, is_file_readable/1,
+ get_version/0, get_myhosts/0, get_mylang/0,
+ get_ejabberd_config_path/0, is_using_elixir_config/0,
+ prepare_opt_val/4, convert_table_to_binary/5,
+ transform_options/1, collect_options/1, default_db/2,
+ convert_to_yaml/1, convert_to_yaml/2, v_db/2,
+ env_binary_to_list/2, opt_type/1, may_hide_data/1,
+ is_elixir_enabled/0, v_dbs/1, v_dbs_mods/1]).
-export([start/2]).
@@ -893,6 +893,19 @@ v_db(Mod, Type) ->
[] -> erlang:error(badarg)
end.
+-spec v_dbs(module()) -> [atom()].
+
+v_dbs(Mod) ->
+ lists:flatten(ets:match(module_db, {Mod, '$1'})).
+
+-spec v_dbs_mods(module()) -> [module()].
+
+v_dbs_mods(Mod) ->
+ lists:map(fun([M]) ->
+ binary_to_atom(<<(atom_to_binary(Mod, utf8))/binary, "_",
+ (atom_to_binary(M, utf8))/binary>>, utf8)
+ end, ets:match(module_db, {Mod, '$1'})).
+
-spec default_db(binary(), module()) -> atom().
default_db(Host, Module) ->