From 63f1d88ed3d09d89ff768a4ea6abbada7944f0d1 Mon Sep 17 00:00:00 2001 From: zhouzb Date: Mon, 22 Nov 2021 22:23:06 +0800 Subject: [PATCH] chore(dashboard): disable by default --- apps/emqx_dashboard/src/emqx_dashboard.erl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/emqx_dashboard/src/emqx_dashboard.erl b/apps/emqx_dashboard/src/emqx_dashboard.erl index 7bf6f0f5a..0dbcb8f1e 100644 --- a/apps/emqx_dashboard/src/emqx_dashboard.erl +++ b/apps/emqx_dashboard/src/emqx_dashboard.erl @@ -49,10 +49,16 @@ start_listeners() -> type => 'apiKey', name => "authorization", in => header}}}}, - Dispatch = [{"/", cowboy_static, {priv_file, emqx_dashboard, "www/index.html"}}, - {"/static/[...]", cowboy_static, {priv_dir, emqx_dashboard, "www/static"}}, - {'_', cowboy_static, {priv_file, emqx_dashboard, "www/index.html"}} - ], + Dispatch = + case os:getenv("_EMQX_ENABLE_DASHBOARD") of + V when V =:= "true" orelse V =:= "1" -> + [{"/", cowboy_static, {priv_file, emqx_dashboard, "www/index.html"}}, + {"/static/[...]", cowboy_static, {priv_dir, emqx_dashboard, "www/static"}}, + {'_', cowboy_static, {priv_file, emqx_dashboard, "www/index.html"}} + ]; + _ -> + [] + end, BaseMinirest = #{ base_path => ?BASE_PATH, modules => minirest_api:find_api_modules(apps()),