Merge pull request #5859 from zmstone/chore-dashboard-allow-enabling-dashbaord-for-test

chore(dashboard): Allow test mode of the dashboard
This commit is contained in:
Zaiming (Stone) Shi 2021-09-30 09:34:18 +02:00 committed by GitHub
commit 86bf8499f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 7 deletions

View File

@ -47,13 +47,17 @@ start_listeners() ->
type => apiKey,
name => "authorization",
in => header}}}},
%% TODO: open dashboard after beta 1
%% 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 = [],
%% TODO: make it permanent when it's ready to release
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()),