Просмотр исходного кода

chore(dashboard): disable by default

zhouzb 4 лет назад
Родитель
Сommit
63f1d88ed3
1 измененных файлов с 10 добавлено и 4 удалено
  1. 10 4
      apps/emqx_dashboard/src/emqx_dashboard.erl

+ 10 - 4
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()),