Skip to content

Commit

Permalink
Merge pull request #2929 from esl/toml-config
Browse files Browse the repository at this point in the history
TOML config
  • Loading branch information
leszke authored Jan 18, 2021
2 parents 2147068 + 2584101 commit 6171e56
Show file tree
Hide file tree
Showing 154 changed files with 5,796 additions and 14,623 deletions.
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ clean:
-rm -rf asngen
-rm configure.out
-rm rel/configure.vars.config
-rm rel/vars.config
-rm rel/vars-toml.config

# REBAR_CT_EXTRA_ARGS comes from a test runner
Expand All @@ -28,7 +27,7 @@ ct:
eunit:
@$(RUN) $(REBAR) eunit

rel: certs configure.out rel/vars.config rel/vars-toml.config
rel: certs configure.out rel/vars-toml.config
. ./configure.out && $(REBAR) as prod release

shell: certs etc/mongooseim.cfg
Expand All @@ -41,9 +40,6 @@ rock:
elif [ "$(BRANCH)" ]; then tools/rock_changed.sh $(BRANCH); \
else tools/rock_changed.sh; fi

rel/vars.config: rel/vars.config.in rel/configure.vars.config
cat $^ > $@

rel/vars-toml.config: rel/vars-toml.config.in rel/configure.vars.config
cat $^ > $@

Expand All @@ -60,7 +56,7 @@ devrel: $(DEVNODES)
print_devnodes:
@echo $(DEVNODES)

$(DEVNODES): certs configure.out rel/vars.config rel/vars-toml.config
$(DEVNODES): certs configure.out rel/vars-toml.config
@echo "building $@"
(. ./configure.out && \
DEVNODE=true $(RUN) $(REBAR) as $@ release)
Expand Down
1 change: 0 additions & 1 deletion big_tests/default.spec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
{suites, "tests", cluster_commands_SUITE}.
{suites, "tests", component_SUITE}.
{suites, "tests", conf_reload_SUITE}.
{suites, "tests", config_format_SUITE}.
{suites, "tests", connect_SUITE}.
{suites, "tests", disco_and_caps_SUITE}.
{suites, "tests", ejabberdctl_SUITE}.
Expand Down
9 changes: 8 additions & 1 deletion big_tests/run_common_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ enable_preset_on_node(Node, PresetVars, HostVarsFilePrefix) ->
ok.

template_config(Template, Vars) ->
MergedVars = merge_vars(Vars),
MergedVars = ensure_binary_strings(merge_vars(Vars)),
%% Render twice to replace variables in variables
Tmp = bbmustache:render(Template, MergedVars, [{key_type, atom}]),
bbmustache:render(Tmp, MergedVars, [{key_type, atom}]).
Expand All @@ -306,6 +306,13 @@ merge_vars([Vars1, Vars2|Rest]) ->
merge_vars([Vars|Rest]);
merge_vars([Vars]) -> Vars.

%% bbmustache tries to iterate over lists, so we need to make them binaries
ensure_binary_strings(Vars) ->
lists:map(fun({dbs, V}) -> {dbs, V};
({K, V}) when is_list(V) -> {K, list_to_binary(V)};
({K, V}) -> {K, V}
end, Vars).

call(Node, M, F, A) ->
case rpc:call(Node, M, F, A) of
{badrpc, Reason} ->
Expand Down
144 changes: 5 additions & 139 deletions big_tests/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
{odbc_mssql_mnesia,
[{dbs, [redis, mssql]},
{auth_method, "\"rdbms\""},
{rdbms_server_type, "rdbms_server_type = \"mssql\""},
{rdbms_server_type, "\"mssql\""},
{outgoing_pools, "[outgoing_pools.redis.global_distrib]
scope = \"global\"
workers = 10
Expand Down Expand Up @@ -357,11 +357,11 @@
strategy = \"next_worker\"
connection.address = \"127.0.0.1\"
connection.port = 8087
connection.username = \"ejabberd\"
connection.password = \"mongooseim_secret\"
connection.tls.ciphers = [\"AES256-SHA\", \"DHE-RSA-AES128-SHA256\"]
connection.credentials.user = \"ejabberd\"
connection.credentials.password = \"mongooseim_secret\"
connection.tls.ciphers = \"AES256-SHA:DHE-RSA-AES128-SHA256\"
connection.tls.server_name_indication = false
connection.cacertfile = \"priv/ssl/cacert.pem\""},
connection.tls.cacertfile = \"priv/ssl/cacert.pem\""},
{mod_last, "[modules.mod_last]
backend = \"riak\""},
{mod_privacy, "[modules.mod_privacy]
Expand Down Expand Up @@ -390,140 +390,6 @@
scope = \"global\""},
{mod_offline, "[modules.mod_offline]"}
]}
]},
{cfg, % preset vars for the 'cfg' format - used only by the config equivalence tests
[
{internal_mnesia,
%% dbs variable is used by ./tools/test_runner/presets_to_dbs.sh script
[{dbs, [redis, minio]},
{sm_backend, "{mnesia, []}"},
{auth_method, "internal"},
{outgoing_pools, "{outgoing_pools, [
{redis, global, global_distrib, [{workers, 10}], []}
]}."},
{mod_offline, "{mod_offline, []},"}]},
{pgsql_mnesia,
[{dbs, [redis, pgsql]},
{sm_backend, "{mnesia, []}"},
{auth_method, "rdbms"},
{outgoing_pools, "{outgoing_pools, [
{redis, global, global_distrib, [{workers, 10}], []},
{rdbms, global, default, [{workers, 5}],
[{server, {pgsql, \"localhost\", \"ejabberd\", \"ejabberd\", \"mongooseim_secret\",
[{ssl, required}, {ssl_opts, [{verify, verify_peer},
{cacertfile, \"priv/ssl/cacert.pem\"}, {server_name_indication, disable}]}]}}]}
]}."},
{mod_last, "{mod_last, [{backend, rdbms}]},"},
{mod_privacy, "{mod_privacy, [{backend, rdbms}]},"},
{mod_private, "{mod_private, [{backend, rdbms}]},"},
{mod_offline, "{mod_offline, [{backend, rdbms}]},"},
{mod_vcard, "{mod_vcard, [{backend, rdbms}, {host, \"vjud.@HOST@\"}]},"},
{mod_roster, "{mod_roster, [{backend, rdbms}]},"}]},
{odbc_mssql_mnesia,
[{dbs, [redis, mssql]},
{sm_backend, "{mnesia, []}"},
{auth_method, "rdbms"},
{rdbms_server_type, "{rdbms_server_type, mssql}."},
{outgoing_pools, "{outgoing_pools, [
{redis, global, global_distrib, [{workers, 10}], []},
{rdbms, global, default, [{workers, 5}],
[{server, \"DSN=mongoose-mssql;UID=sa;PWD=mongooseim_secret+ESL123\"}]}
]}."},
{mod_last, "{mod_last, [{backend, rdbms}]},"},
{mod_privacy, "{mod_privacy, [{backend, rdbms}]},"},
{mod_private, "{mod_private, [{backend, rdbms}]},"},
{mod_offline, "{mod_offline, [{backend, rdbms}]},"},
{mod_vcard, "{mod_vcard, [{backend, rdbms}, {host, \"vjud.@HOST@\"}]},"},
{mod_roster, "{mod_roster, [{backend, rdbms}]},"}]},
{mysql_redis,
[{dbs, [redis, mysql]},
{sm_backend, "{redis, []}"},
{auth_method, "rdbms"},
{outgoing_pools, "{outgoing_pools, [
{redis, global, global_distrib, [{workers, 10}], []},
{redis, global, default, [{workers, 10}, {strategy, random_worker}], []},
{rdbms, global, default, [{workers, 5}],
[{server, {mysql, \"localhost\", \"ejabberd\", \"ejabberd\", \"mongooseim_secret\",
[{versions, ['tlsv1.2']}, {verify, verify_peer}, {cacertfile, \"priv/ssl/cacert.pem\"}]}}]}
]}."},
{mod_last, "{mod_last, [{backend, rdbms}]},"},
{mod_privacy, "{mod_privacy, [{backend, rdbms}]},"},
{mod_private, "{mod_private, [{backend, rdbms}]},"},
{mod_offline, "{mod_offline, [{backend, rdbms}]},"},
{mod_vcard, "{mod_vcard, [{backend, rdbms}, {host, \"vjud.@HOST@\"}]},"},
{mod_roster, "{mod_roster, [{backend, rdbms}]},"}]},
{ldap_mnesia,
[{dbs, [redis, ldap]},
{sm_backend, "{mnesia, []}"},
{auth_method, "ldap"},
{outgoing_pools, "{outgoing_pools, [
{redis, global, global_distrib, [{workers, 10}], []},
{ldap, global, default, [{workers, 5}], [{port, 3636},
{rootdn, \"cn=admin,dc=esl,dc=com\"},
{password, \"mongooseim_secret\"},
{encrypt, tls},
{tls_options, [{versions, ['tlsv1.2']},
{verify, verify_peer},
{cacertfile, \"priv/ssl/cacert.pem\"},
{certfile, \"priv/ssl/fake_cert.pem\"},
{keyfile, \"priv/ssl/fake_key.pem\"}]}]},
{ldap, global, bind, [{workers, 5}], [{port, 3636},
{encrypt, tls},
{tls_options, [{versions, ['tlsv1.2']},
{verify, verify_peer},
{cacertfile, \"priv/ssl/cacert.pem\"},
{certfile, \"priv/ssl/fake_cert.pem\"},
{keyfile, \"priv/ssl/fake_key.pem\"}]}]}
]}."},
{mod_offline, "{mod_offline, []},"},
{password_format, "{password_format, scram}"},
{auth_ldap, ", {ldap_base, \"ou=Users,dc=esl,dc=com\"},
{ldap_filter, \"(objectClass=inetOrgPerson)\"}"
},
{mod_vcard,"{mod_vcard, [{backend, ldap}, {host, \"vjud.@HOST@\"},\n"
"{ldap_base, \"ou=Users,dc=esl,dc=com\"},\n"
"{ldap_filter,\"(objectClass=inetOrgPerson)\"}\n"
"]},"}
]},
{riak_mnesia,
[{dbs, [redis, riak]},
{sm_backend, "{mnesia, []}"},
{auth_method, "riak"},
%% Specify a list of ciphers to avoid
%% "no function clause matching tls_v1:enum_to_oid(28)" error
%% on Riak's side running with Erlang R16.
%% https://github.com/basho/riak-erlang-client/issues/232#issuecomment-178612129
%% We also set ciphers in tools/setup_riak on the server side.
{outgoing_pools, "{outgoing_pools, [
{redis, global, global_distrib, [{workers, 10}], []},
{riak, global, default, [{workers, 5},
{strategy, next_worker}],
[{address, \"127.0.0.1\"},{port, 8087},
{ssl_opts, [{ciphers, [\"AES256-SHA\", \"DHE-RSA-AES128-SHA256\"]},
{server_name_indication, disable}]},
{credentials, \"ejabberd\", \"mongooseim_secret\"},
{cacertfile, \"priv/ssl/cacert.pem\"}]}
]}."},
{mod_roster, "{mod_roster, [{backend, riak}]},"},
{mod_private, "{mod_private, [{backend, riak}]},"},
{mod_vcard, "{mod_vcard, [{backend, riak}, {host, \"vjud.@HOST@\"}]},"},
{mod_offline, "{mod_offline, [{backend, riak}]},"},
{mod_last, "{mod_last, [{backend, riak}]},"},
{mod_privacy, "{mod_privacy, [{backend, riak}]},"}
]},
{elasticsearch_and_cassandra_mnesia,
[{dbs, [redis, elasticsearch, cassandra]},
{sm_backend, "{mnesia, []}"},
{outgoing_pools, "{outgoing_pools, [
{redis, global, global_distrib, [{workers, 10}], []},
{cassandra, global, default, [{workers, 20}],
[{ssl,[{cacertfile, \"priv/ssl/cacert.pem\"},
{verify, verify_peer}] }]},
{elastic, global, default, [], []}
]}."},
{auth_method, "internal"},
{mod_offline, "{mod_offline, []},"}
]}
]}
]}.

Expand Down
3 changes: 0 additions & 3 deletions big_tests/tests/accounts_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,5 @@ enable_watcher(Config, Watcher) ->
disable_watcher(Config) ->
restore_mod_register_options(Config).

watcher(Watcher) ->
{registration_watchers, [binary_to_list(Watcher)]}.

domain() ->
ct:get_config({hosts, mim, domain}).
155 changes: 0 additions & 155 deletions big_tests/tests/config_format_SUITE.erl

This file was deleted.

Loading

0 comments on commit 6171e56

Please sign in to comment.