From ed0d0b9787e56bd46560146f0d4ec9f616ace5fd Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Thu, 4 May 2023 15:22:49 +0200 Subject: [PATCH] build: check mnesia compatibility when generating mria config --- dev | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/dev b/dev index cab5f1dfc..18e4cbc93 100755 --- a/dev +++ b/dev @@ -206,10 +206,21 @@ make_erlang_args() { } call_hocon() { + local args erl_code args="$(make_erlang_args "$@")" - erl -noshell \ - -eval "{ok, _} = application:ensure_all_started(hocon), \ - ok = hocon_cli:main([$args]), init:stop()." + erl_code=" + {ok, _} = application:ensure_all_started(hocon), \ + try + mnesia_hook:module_info() + catch _:_-> + io:format(standard_error, \"Force setting DB backend to 'mnesia', and 'role' to 'core'~n\", []), + os:putenv(\"EMQX_NODE__DB_BACKEND\", \"mnesia\"), + os:putenv(\"EMQX_NODE__DB_ROLE\", \"core\") + end, + ok = hocon_cli:main([$args]), + init:stop(). + " + erl -noshell -eval "$erl_code" } # Function to generate app.config and vm.args