chore: don't copy i18n.conf

This commit is contained in:
Zhongwen Deng 2022-06-30 22:55:17 +08:00
parent b3ec3c9dfb
commit 92019e4d4c
10 changed files with 15 additions and 29 deletions

View File

@ -146,7 +146,8 @@ dump_schema(Dir, SchemaModule, I18nFile) ->
fun(Lang) -> fun(Lang) ->
gen_config_md(Dir, I18nFile, SchemaModule, Lang), gen_config_md(Dir, I18nFile, SchemaModule, Lang),
gen_api_schema_json(Dir, I18nFile, Lang), gen_api_schema_json(Dir, I18nFile, Lang),
gen_example_conf(filename:dirname(I18nFile), I18nFile, SchemaModule, Lang) ExampleDir = filename:join(filename:dirname(filename:dirname(I18nFile)), "etc"),
gen_example_conf(ExampleDir, I18nFile, SchemaModule, Lang)
end, end,
[en, zh] [en, zh]
), ),

View File

@ -19,8 +19,8 @@ doc_gen_test() ->
"test", "test",
"lib", "lib",
"emqx_dashboard", "emqx_dashboard",
"etc", "priv",
"i18n.conf.all" "i18n.conf"
]), ]),
_ = emqx_conf:dump_schema(Dir, emqx_conf_schema, I18nFile), _ = emqx_conf:dump_schema(Dir, emqx_conf_schema, I18nFile),
ok ok

View File

@ -55,9 +55,8 @@ set_default_config(DefaultUsername) ->
}, },
emqx_config:put([dashboard], Config), emqx_config:put([dashboard], Config),
I18nFile = filename:join([ I18nFile = filename:join([
filename:dirname(code:priv_dir(emqx_dashboard)), code:priv_dir(emqx_dashboard),
"etc", "i18n.conf"
"i18n.conf.all"
]), ]),
application:set_env(emqx_dashboard, i18n_file, I18nFile), application:set_env(emqx_dashboard, i18n_file, I18nFile),
ok. ok.

2
build
View File

@ -92,7 +92,7 @@ make_docs() {
# shellcheck disable=SC2086 # shellcheck disable=SC2086
erl -noshell -pa $libs_dir1 $libs_dir2 $libs_dir3 -eval \ erl -noshell -pa $libs_dir1 $libs_dir2 $libs_dir3 -eval \
"Dir = filename:join([apps, emqx_dashboard, priv, www, static]), \ "Dir = filename:join([apps, emqx_dashboard, priv, www, static]), \
I18nFile = filename:join([apps, emqx_dashboard, etc, 'i18n.conf.all']), \ I18nFile = filename:join([apps, emqx_dashboard, priv, 'i18n.conf']), \
ok = emqx_conf:dump_schema(Dir, $SCHEMA_MODULE, I18nFile), \ ok = emqx_conf:dump_schema(Dir, $SCHEMA_MODULE, I18nFile), \
halt(0)." halt(0)."
} }

View File

@ -49,7 +49,7 @@ VOLUME ["/opt/emqx/log", "/opt/emqx/data"]
# - 8883 port for MQTT(SSL) # - 8883 port for MQTT(SSL)
# - 11883 port for internal MQTT/TCP # - 11883 port for internal MQTT/TCP
# - 18083 for dashboard # - 18083 for dashboard
# - 4370 default Erlang distrbution port # - 4370 default Erlang distribution port
# - 5369 for backplain gen_rpc # - 5369 for backplain gen_rpc
EXPOSE 1883 8081 8083 8084 8883 11883 18083 4370 5369 EXPOSE 1883 8081 8083 8084 8883 11883 18083 4370 5369

View File

@ -19,8 +19,8 @@ doc_gen_test() ->
"test", "test",
"lib", "lib",
"emqx_dashboard", "emqx_dashboard",
"etc", "priv",
"i18n.conf.all" "i18n.conf"
]), ]),
_ = emqx_conf:dump_schema(Dir, emqx_enterprise_conf_schema, I18nFile), _ = emqx_conf:dump_schema(Dir, emqx_enterprise_conf_schema, I18nFile),
ok ok

10
mix.exs
View File

@ -322,16 +322,6 @@ defmodule EMQXUmbrella.MixProject do
Path.join(etc, "certs") Path.join(etc, "certs")
) )
# required by emqx_dashboard
Mix.Generator.copy_file(
"apps/emqx_dashboard/etc/i18n.conf.all",
Path.join(
release.path,
"lib/emqx_dashboard-#{release.applications.emqx_dashboard[:vsn]}/priv/i18n.conf"
),
force: overwrite?
)
Mix.Generator.copy_file( Mix.Generator.copy_file(
"apps/emqx_dashboard/etc/emqx.conf.en.example", "apps/emqx_dashboard/etc/emqx.conf.en.example",
Path.join(etc, "emqx-example.conf"), Path.join(etc, "emqx-example.conf"),

View File

@ -1,9 +1,9 @@
%% -*- mode: erlang -*- %% -*- mode: erlang -*-
%% This config file is the very basic config to compile emqx %% This config file is the very basic config to compile emqx
%% This allows emqx to be used as a dependency for other applications %% This allows emqx to be used as a dependency for other applications
%% such as emqx module/plugin develpments and tests. %% such as emqx module/plugin developments and tests.
%% With the help of EMQ's rebar3 fork, the config is extended %% With the help of EMQX's rebar3 fork, the config is extended
%% with rebar.config.erl module. Final result is written to %% with rebar.config.erl module. Final result is written to
%% rebar.config.rendered if environment DEBUG is set. %% rebar.config.rendered if environment DEBUG is set.

View File

@ -424,16 +424,12 @@ emqx_etc_overlay_common() ->
emqx_etc_overlay_per_edition(ce) -> emqx_etc_overlay_per_edition(ce) ->
[ [
{"{{base_dir}}/lib/emqx_conf/etc/emqx.conf.all", "etc/emqx.conf"}, {"{{base_dir}}/lib/emqx_conf/etc/emqx.conf.all", "etc/emqx.conf"}
{"{{base_dir}}/lib/emqx_dashboard/etc/i18n.conf.all",
"{{base_dir}}/lib/emqx_dashboard/priv/i18n.conf"}
]; ];
emqx_etc_overlay_per_edition(ee) -> 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_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"}
{"{{base_dir}}/lib/emqx_dashboard/etc/i18n.conf.all",
"{{base_dir}}/lib/emqx_dashboard/priv/i18n.conf"}
]. ].
get_vsn(Profile) -> get_vsn(Profile) ->

View File

@ -8,7 +8,7 @@ main(_) ->
Conf = [merge(BaseConf, Cfgs), Conf = [merge(BaseConf, Cfgs),
io_lib:nl() io_lib:nl()
], ],
ok = file:write_file("apps/emqx_dashboard/etc/i18n.conf.all", Conf). ok = file:write_file("apps/emqx_dashboard/priv/i18n.conf", Conf).
merge(BaseConf, Cfgs) -> merge(BaseConf, Cfgs) ->
lists:foldl( lists:foldl(