refactor: stop creating emqx-enterprise.conf

This commit is contained in:
Zaiming (Stone) Shi 2023-05-03 22:03:15 +02:00
parent ddd68eff22
commit 7c1b453285
5 changed files with 11 additions and 46 deletions

View File

@ -612,7 +612,7 @@ check_license() {
set +x set +x
logerr "License not found." logerr "License not found."
logerr "Please specify one via the EMQX_LICENSE__KEY variable" logerr "Please specify one via the EMQX_LICENSE__KEY variable"
logerr "or via license.key in emqx-enterprise.conf." logerr "or via license.key in emqx.conf."
return 1 return 1
fi fi
} }

12
mix.exs
View File

@ -385,7 +385,9 @@ defmodule EMQXUmbrella.MixProject do
emqx_bridge_oracle: :permanent, emqx_bridge_oracle: :permanent,
emqx_ee_schema_registry: :permanent emqx_ee_schema_registry: :permanent
], ],
else: [] else: [
emqx_telemetry: :permanent
]
) )
end end
@ -524,14 +526,6 @@ defmodule EMQXUmbrella.MixProject do
Path.join(etc, "emqx.conf") Path.join(etc, "emqx.conf")
) )
if edition_type == :enterprise do
render_template(
"apps/emqx_conf/etc/emqx-enterprise.conf.all",
assigns,
Path.join(etc, "emqx-enterprise.conf")
)
end
render_template( render_template(
"rel/emqx_vars", "rel/emqx_vars",
assigns, assigns,

View File

@ -505,8 +505,8 @@ relx_overlay(ReleaseType, Edition) ->
{copy, "bin/nodetool", "bin/nodetool-{{release_version}}"} {copy, "bin/nodetool", "bin/nodetool-{{release_version}}"}
] ++ etc_overlay(ReleaseType, Edition). ] ++ etc_overlay(ReleaseType, Edition).
etc_overlay(ReleaseType, Edition) -> etc_overlay(ReleaseType, _Edition) ->
Templates = emqx_etc_overlay(ReleaseType, Edition), Templates = emqx_etc_overlay(ReleaseType),
[ [
{mkdir, "etc/"}, {mkdir, "etc/"},
{copy, "{{base_dir}}/lib/emqx/etc/certs", "etc/"}, {copy, "{{base_dir}}/lib/emqx/etc/certs", "etc/"},
@ -520,24 +520,16 @@ etc_overlay(ReleaseType, Edition) ->
Templates Templates
). ).
emqx_etc_overlay(ReleaseType, Edition) -> emqx_etc_overlay(ReleaseType) ->
emqx_etc_overlay_per_rel(ReleaseType) ++ emqx_etc_overlay_per_rel(ReleaseType) ++
emqx_etc_overlay_per_edition(Edition) ++ emqx_etc_overlay().
emqx_etc_overlay_common().
emqx_etc_overlay_per_rel(cloud) -> emqx_etc_overlay_per_rel(cloud) ->
[{"{{base_dir}}/lib/emqx/etc/vm.args.cloud", "etc/vm.args"}]. [{"{{base_dir}}/lib/emqx/etc/vm.args.cloud", "etc/vm.args"}].
emqx_etc_overlay_common() -> emqx_etc_overlay() ->
[{"{{base_dir}}/lib/emqx/etc/ssl_dist.conf", "etc/ssl_dist.conf"}].
emqx_etc_overlay_per_edition(ce) ->
[ [
{"{{base_dir}}/lib/emqx_conf/etc/emqx.conf.all", "etc/emqx.conf"} {"{{base_dir}}/lib/emqx/etc/ssl_dist.conf", "etc/ssl_dist.conf"},
];
emqx_etc_overlay_per_edition(ee) ->
[
{"{{base_dir}}/lib/emqx_conf/etc/emqx-enterprise.conf.all", "etc/emqx-enterprise.conf"},
{"{{base_dir}}/lib/emqx_conf/etc/emqx.conf.all", "etc/emqx.conf"} {"{{base_dir}}/lib/emqx_conf/etc/emqx.conf.all", "etc/emqx.conf"}
]. ].

View File

@ -14,35 +14,15 @@
main(_) -> main(_) ->
{ok, BaseConf} = file:read_file("apps/emqx_conf/etc/emqx_conf.conf"), {ok, BaseConf} = file:read_file("apps/emqx_conf/etc/emqx_conf.conf"),
Cfgs = get_all_cfgs("apps/"), Cfgs = get_all_cfgs("apps/"),
IsEnterprise = is_enterprise(),
Enterprise =
case IsEnterprise of
false -> [];
true -> [io_lib:nl(), "include emqx-enterprise.conf", io_lib:nl()]
end,
Conf = [ Conf = [
merge(BaseConf, Cfgs), merge(BaseConf, Cfgs),
io_lib:nl(), io_lib:nl()
Enterprise
], ],
ok = file:write_file("apps/emqx_conf/etc/emqx.conf.all", Conf), ok = file:write_file("apps/emqx_conf/etc/emqx.conf.all", Conf),
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,
merge_desc_files_per_lang("en"), merge_desc_files_per_lang("en"),
%% TODO: remove this when we have zh translation moved to dashboard package %% TODO: remove this when we have zh translation moved to dashboard package
merge_desc_files_per_lang("zh"). merge_desc_files_per_lang("zh").
is_enterprise() ->
Profile = os:getenv("PROFILE", "emqx"),
nomatch =/= string:find(Profile, "enterprise").
merge(BaseConf, Cfgs) -> merge(BaseConf, Cfgs) ->
Confs = [BaseConf | lists:map(fun read_conf/1, Cfgs)], Confs = [BaseConf | lists:map(fun read_conf/1, Cfgs)],
infix(lists:filter(fun(I) -> iolist_size(I) > 0 end, Confs), [io_lib:nl(), io_lib:nl()]). infix(lists:filter(fun(I) -> iolist_size(I) > 0 end, Confs), [io_lib:nl(), io_lib:nl()]).

View File

@ -90,5 +90,4 @@ authorization {
] ]
} }
include emqx-enterprise.conf
include influx-bridge.conf include influx-bridge.conf