diff --git a/apps/emqx_conf/README.md b/apps/emqx_conf/README.md index f1efe7987..d33af7ce2 100644 --- a/apps/emqx_conf/README.md +++ b/apps/emqx_conf/README.md @@ -5,7 +5,6 @@ This application provides configuration management capabilities for EMQX. At compile time it reads all configuration schemas and generates the following files: * `config-en.md`: documentation for all configuration options. * `schema-en.json`: JSON description of all configuration schema options. - * `emqx.conf.example`: an example of a complete configuration file. At runtime, it provides: - Cluster configuration synchronization capability. diff --git a/apps/emqx_conf/etc/emqx_conf.conf b/apps/emqx_conf/etc/emqx_conf.conf index 2d7b8d910..2f2d1a779 100644 --- a/apps/emqx_conf/etc/emqx_conf.conf +++ b/apps/emqx_conf/etc/emqx_conf.conf @@ -7,7 +7,7 @@ ## To avoid confusion, please do not store the same configs in both files. ## ## See {{ emqx_configuration_doc }} for more details. -## Configuration full example can be found in emqx.conf.example +## Configuration full example can be found in etc/examples node { name = "emqx@127.0.0.1" diff --git a/apps/emqx_conf/src/emqx_conf.erl b/apps/emqx_conf/src/emqx_conf.erl index 584a10a8d..51c353edf 100644 --- a/apps/emqx_conf/src/emqx_conf.erl +++ b/apps/emqx_conf/src/emqx_conf.erl @@ -30,7 +30,6 @@ -export([reset/2, reset/3]). -export([dump_schema/2]). -export([schema_module/0]). --export([gen_example_conf/2]). -export([check_config/2]). %% TODO: move to emqx_dashboard when we stop building api schema at build time @@ -161,8 +160,7 @@ dump_schema(Dir, SchemaModule) -> ok = gen_schema_json(Dir, SchemaModule, Lang) end, ["en", "zh"] - ), - ok = gen_example_conf(Dir, SchemaModule). + ). %% for scripts/spellcheck. gen_schema_json(Dir, SchemaModule, Lang) -> @@ -202,11 +200,6 @@ gen_config_md(Dir, SchemaModule, Lang) -> io:format(user, "===< Generating: ~s~n", [SchemaMdFile]), ok = gen_doc(SchemaMdFile, SchemaModule, Lang). -gen_example_conf(Dir, SchemaModule) -> - SchemaMdFile = filename:join([Dir, "emqx.conf.example"]), - io:format(user, "===< Generating: ~s~n", [SchemaMdFile]), - ok = gen_example(SchemaMdFile, SchemaModule). - %% @doc return the root schema module. -spec schema_module() -> module(). schema_module() -> @@ -250,17 +243,6 @@ gen_doc(File, SchemaModule, Lang) -> Doc = hocon_schema_md:gen(SchemaModule, Opts), file:write_file(File, Doc). -gen_example(File, SchemaModule) -> - %% we do not generate description in example files - %% so there is no need for a desc_resolver - Opts = #{ - title => <<"EMQX Configuration Example">>, - body => <<"">>, - include_importance_up_from => ?IMPORTANCE_MEDIUM - }, - Example = hocon_schema_example:gen(SchemaModule, Opts), - file:write_file(File, Example). - gen_api_schema_json_iodata(SchemaMod, SchemaInfo) -> emqx_dashboard_swagger:gen_api_schema_json_iodata( SchemaMod, diff --git a/mix.exs b/mix.exs index 1274991ff..5f60a2e34 100644 --- a/mix.exs +++ b/mix.exs @@ -541,9 +541,9 @@ defmodule EMQXUmbrella.MixProject do profile = System.get_env("MIX_ENV") - Mix.Generator.copy_file( - "_build/docgen/#{profile}/emqx.conf.example", - Path.join(etc, "emqx.conf.example"), + File.cp_r!( + "examples", + Path.join(etc, "examples"), force: overwrite? ) diff --git a/rebar.config.erl b/rebar.config.erl index a0bfa8744..fc91878d9 100644 --- a/rebar.config.erl +++ b/rebar.config.erl @@ -524,7 +524,7 @@ etc_overlay(ReleaseType, _Edition) -> [ {mkdir, "etc/"}, {copy, "{{base_dir}}/lib/emqx/etc/certs", "etc/"}, - {copy, "_build/docgen/" ++ profile() ++ "/emqx.conf.example", "etc/emqx.conf.example"} + {copy, "examples", "etc/"} ] ++ lists:map( fun