diff --git a/scripts/merge-config.escript b/scripts/merge-config.escript index f617dbb70..f78083ee1 100755 --- a/scripts/merge-config.escript +++ b/scripts/merge-config.escript @@ -12,13 +12,13 @@ -define(APPS, ["emqx", "emqx_dashboard", "emqx_authz"]). main(_) -> - Profile = os:getenv("PROFILE", "emqx"), {ok, BaseConf} = file:read_file("apps/emqx_conf/etc/emqx_conf.conf"), Cfgs = get_all_cfgs("apps/"), + IsEnterprise = is_enterprise(), Enterprise = - case Profile of - "emqx" -> []; - "emqx-enterprise" -> [io_lib:nl(), "include emqx-enterprise.conf", io_lib:nl()] + case IsEnterprise of + false -> []; + true -> [io_lib:nl(), "include emqx-enterprise.conf", io_lib:nl()] end, Conf = [ merge(BaseConf, Cfgs), @@ -27,10 +27,18 @@ main(_) -> ], ok = file:write_file("apps/emqx_conf/etc/emqx.conf.all", Conf), - EnterpriseCfgs = get_all_cfgs("lib-ee/"), - EnterpriseConf = merge("", EnterpriseCfgs), + case IsEnterprise of + true -> + EnterpriseCfgs = get_all_cfgs("lib-ee/"), + EnterpriseConf = merge("", EnterpriseCfgs), + ok = file:write_file("apps/emqx_conf/etc/emqx-enterprise.conf.all", EnterpriseConf); + false -> + ok + end. - ok = file:write_file("apps/emqx_conf/etc/emqx-enterprise.conf.all", EnterpriseConf). +is_enterprise() -> + Profile = os:getenv("PROFILE", "emqx"), + nomatch =/= string:find(Profile, "enterprise"). merge(BaseConf, Cfgs) -> lists:foldl(