diff --git a/.ci/build_packages/tests.sh b/.ci/build_packages/tests.sh index 9224a6b82..ffb156e45 100755 --- a/.ci/build_packages/tests.sh +++ b/.ci/build_packages/tests.sh @@ -39,7 +39,7 @@ emqx_test(){ unzip -q "${PACKAGE_PATH}/${packagename}" export EMQX_ZONE__EXTERNAL__SERVER_KEEPALIVE=60 \ EMQX_MQTT__MAX_TOPIC_ALIAS=10 - [[ $(arch) == *arm* || $(arch) == aarch64 ]] && export EMQX_LISTENER__QUIC__EXTERNAL__ENDPOINT='' + [[ $(arch) == *arm* || $(arch) == aarch64 ]] && export EMQX_ZONES__DEFAULT__LISTENERS__MQTT_QUIC__ENABLED=false # sed -i '/emqx_telemetry/d' "${PACKAGE_PATH}"/emqx/data/loaded_plugins echo "running ${packagename} start" @@ -125,7 +125,7 @@ export EMQX_MQTT__MAX_TOPIC_ALIAS=10 EOF ## for ARM, due to CI env issue, skip start of quic listener for the moment [[ $(arch) == *arm* || $(arch) == aarch64 ]] && tee tee -a "$emqx_env_vars" <.listeners..type diff --git a/apps/emqx/rebar.config.script b/apps/emqx/rebar.config.script index 2352e4a81..9d4e443ed 100644 --- a/apps/emqx/rebar.config.script +++ b/apps/emqx/rebar.config.script @@ -13,7 +13,7 @@ IsWin32 = fun() -> IsQuicSupp = fun() -> not (IsCentos6() orelse IsWin32() orelse - false =/= os:getenv("EMQX_BUILD_WITHOUT_QUIC") + false =/= os:getenv("BUILD_WITHOUT_QUIC") ) end, diff --git a/apps/emqx/src/emqx_listeners.erl b/apps/emqx/src/emqx_listeners.erl index a1ef71cf3..eb87d3312 100644 --- a/apps/emqx/src/emqx_listeners.erl +++ b/apps/emqx/src/emqx_listeners.erl @@ -45,6 +45,9 @@ start_listener(ListenerId) -> -spec start_listener(atom(), atom(), map()) -> ok | {error, term()}. start_listener(ZoneName, ListenerName, #{type := Type, bind := Bind} = Conf) -> case do_start_listener(ZoneName, ListenerName, Conf) of + {error, listener_disabled} -> + console_print("- Skip - starting ~s listener ~s on ~s ~n", + [Type, listener_id(ZoneName, ListenerName), format(Bind)]); {ok, _} -> console_print("Start ~s listener ~s on ~s successfully.~n", [Type, listener_id(ZoneName, ListenerName), format(Bind)]); @@ -63,7 +66,9 @@ console_print(_Fmt, _Args) -> ok. %% Start MQTT/TCP listener -spec(do_start_listener(atom(), atom(), map()) - -> {ok, pid()} | {error, term()}). + -> {ok, pid() | {skipped, atom()}} | {error, term()}). +do_start_listener(_ZoneName, _ListenerName, #{enabled := false}) -> + {error, listener_disabled}; do_start_listener(ZoneName, ListenerName, #{type := tcp, bind := ListenOn} = Opts) -> esockd:open(listener_id(ZoneName, ListenerName), ListenOn, merge_default(esockd_opts(Opts)), {emqx_connection, start_link, diff --git a/apps/emqx/src/emqx_schema.erl b/apps/emqx/src/emqx_schema.erl index 42ccb3173..7d339cb38 100644 --- a/apps/emqx/src/emqx_schema.erl +++ b/apps/emqx/src/emqx_schema.erl @@ -1,3 +1,19 @@ +%%-------------------------------------------------------------------- +%% Copyright (c) 2017-2021 EMQ Technologies Co., Ltd. All Rights Reserved. +%% +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. +%%-------------------------------------------------------------------- + -module(emqx_schema). -dialyzer(no_return). @@ -374,7 +390,8 @@ fields("mqtt_ws_listener") -> ] ++ mqtt_listener(); fields("mqtt_quic_listener") -> - [ {"type", t(quic)} + [ {"enabled", t(boolean(), undefined, true)} + , {"type", t(quic)} , {"certfile", t(string(), undefined, undefined)} , {"keyfile", t(string(), undefined, undefined)} , {"ciphers", t(comma_separated_list(), undefined, "TLS_AES_256_GCM_SHA384,"