diff --git a/include/mongoose.hrl b/include/mongoose.hrl index 954df5b2cd..519929350f 100644 --- a/include/mongoose.hrl +++ b/include/mongoose.hrl @@ -22,7 +22,7 @@ %% If the ejabberd application description isn't loaded, returns atom: undefined -define(MONGOOSE_VERSION, element(2, application:get_key(mongooseim,vsn))). --define(MYHOSTS, ejabberd_config:get_global_option(hosts)). +-define(MYHOSTS, ejabberd_config:get_global_option_or_default(hosts, [])). -define(ALL_HOST_TYPES, ejabberd_config:get_global_option_or_default(hosts, []) ++ ejabberd_config:get_global_option_or_default(host_types, [])). -define(MYNAME, ejabberd_config:get_global_option(default_server_domain)). diff --git a/src/gen_mod.erl b/src/gen_mod.erl index 7e179f2746..144ead230e 100644 --- a/src/gen_mod.erl +++ b/src/gen_mod.erl @@ -138,6 +138,7 @@ start_module_for_host_type(HostType, Module, Opts0) -> try lists:map(fun mongoose_service:assert_loaded/1, get_required_services(HostType, Module, Opts)), + check_dynamic_domains_support(HostType, Module), Res = Module:start(HostType, Opts), {links, LinksAfter} = erlang:process_info(self(), links), case lists:sort(LinksBefore) =:= lists:sort(LinksAfter) of @@ -184,6 +185,17 @@ start_module_for_host_type(HostType, Module, Opts0) -> end end. +check_dynamic_domains_support(HostType, Module) -> + case lists:member(HostType, ?MYHOSTS) of + true -> ok; + false -> + case gen_mod:does_module_support(Module, dynamic_domains) of + true -> ok; + false -> + error({Module, HostType, dynamic_domains_feature_is_not_supported}) + end + end. + is_mim_or_ct_running() -> ?MODULE:is_app_running(mongooseim) %% Common tests would be very confused if we kill the whole node diff --git a/tools/travis-setup-db.sh b/tools/travis-setup-db.sh index fcdb5d941d..4ad013c650 100755 --- a/tools/travis-setup-db.sh +++ b/tools/travis-setup-db.sh @@ -140,7 +140,7 @@ elif [ "$db" = 'pgsql' ]; then # make clean && make # Than rerun the script to create a new docker container. echo "Configuring postgres with SSL" - sudo -n service postgresql stop || echo "Failed to stop psql" + sudo -n service postgresql stop || echo "Failed to stop pgsql" docker rm -v -f $NAME || echo "Skip removing previous container" cp ${SSLDIR}/mongooseim/cert.pem ${SQL_TEMP_DIR}/fake_cert.pem cp ${SSLDIR}/mongooseim/key.pem ${SQL_TEMP_DIR}/fake_key.pem