Skip to content

Commit

Permalink
Avoid config duplication for mod_vcard, use config.spec
Browse files Browse the repository at this point in the history
  • Loading branch information
chrzaszcz committed Aug 31, 2021
1 parent a475d8f commit 914ef28
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions big_tests/tests/mongoose_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -519,19 +519,7 @@ print_debug_info_for_module(Module) ->
[ModConfig, IqConfig]).

get_vcard_config(Config) ->
Preset = proplists:get_value(preset, Config, undefined),
Backend = preset_to_vcard_backend(Preset),
[{backend, Backend}, {host, {prefix, <<"vjud.">>}}]
++ vcard_backend_specific_options(Backend).

vcard_backend_specific_options(ldap) ->
[{ldap_base, "ou=Users,dc=esl,dc=com"},
{ldap_filter, "(objectClass=inetOrgPerson)"}];
vcard_backend_specific_options(_) ->
[].

preset_to_vcard_backend("ldap_mnesia") -> ldap;
preset_to_vcard_backend("riak_mnesia") -> riak;
preset_to_vcard_backend("internal_mnesia") -> mnesia;
preset_to_vcard_backend("elasticsearch_and_cassandra_mnesia") -> mnesia;
preset_to_vcard_backend(_) -> rdbms.
HostType = domain_helper:host_type(),
CurrentConfigs = rpc(mim(), gen_mod, loaded_modules_with_opts, [HostType]),
{mod_vcard, CurrentVcardConfig} = lists:keyfind(mod_vcard, 1, CurrentConfigs),
CurrentVcardConfig.

0 comments on commit 914ef28

Please sign in to comment.