chore: modify the build to copy examples into the release
This commit is contained in:
parent
c4222557ba
commit
bb2bf059ac
|
@ -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:
|
At compile time it reads all configuration schemas and generates the following files:
|
||||||
* `config-en.md`: documentation for all configuration options.
|
* `config-en.md`: documentation for all configuration options.
|
||||||
* `schema-en.json`: JSON description of all configuration schema 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:
|
At runtime, it provides:
|
||||||
- Cluster configuration synchronization capability.
|
- Cluster configuration synchronization capability.
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
## To avoid confusion, please do not store the same configs in both files.
|
## To avoid confusion, please do not store the same configs in both files.
|
||||||
##
|
##
|
||||||
## See {{ emqx_configuration_doc }} for more details.
|
## 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 {
|
node {
|
||||||
name = "emqx@127.0.0.1"
|
name = "emqx@127.0.0.1"
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
-export([reset/2, reset/3]).
|
-export([reset/2, reset/3]).
|
||||||
-export([dump_schema/2]).
|
-export([dump_schema/2]).
|
||||||
-export([schema_module/0]).
|
-export([schema_module/0]).
|
||||||
-export([gen_example_conf/2]).
|
|
||||||
-export([check_config/2]).
|
-export([check_config/2]).
|
||||||
|
|
||||||
%% TODO: move to emqx_dashboard when we stop building api schema at build time
|
%% 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)
|
ok = gen_schema_json(Dir, SchemaModule, Lang)
|
||||||
end,
|
end,
|
||||||
["en", "zh"]
|
["en", "zh"]
|
||||||
),
|
).
|
||||||
ok = gen_example_conf(Dir, SchemaModule).
|
|
||||||
|
|
||||||
%% for scripts/spellcheck.
|
%% for scripts/spellcheck.
|
||||||
gen_schema_json(Dir, SchemaModule, Lang) ->
|
gen_schema_json(Dir, SchemaModule, Lang) ->
|
||||||
|
@ -202,11 +200,6 @@ gen_config_md(Dir, SchemaModule, Lang) ->
|
||||||
io:format(user, "===< Generating: ~s~n", [SchemaMdFile]),
|
io:format(user, "===< Generating: ~s~n", [SchemaMdFile]),
|
||||||
ok = gen_doc(SchemaMdFile, SchemaModule, Lang).
|
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.
|
%% @doc return the root schema module.
|
||||||
-spec schema_module() -> module().
|
-spec schema_module() -> module().
|
||||||
schema_module() ->
|
schema_module() ->
|
||||||
|
@ -250,17 +243,6 @@ gen_doc(File, SchemaModule, Lang) ->
|
||||||
Doc = hocon_schema_md:gen(SchemaModule, Opts),
|
Doc = hocon_schema_md:gen(SchemaModule, Opts),
|
||||||
file:write_file(File, Doc).
|
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) ->
|
gen_api_schema_json_iodata(SchemaMod, SchemaInfo) ->
|
||||||
emqx_dashboard_swagger:gen_api_schema_json_iodata(
|
emqx_dashboard_swagger:gen_api_schema_json_iodata(
|
||||||
SchemaMod,
|
SchemaMod,
|
||||||
|
|
6
mix.exs
6
mix.exs
|
@ -541,9 +541,9 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
|
|
||||||
profile = System.get_env("MIX_ENV")
|
profile = System.get_env("MIX_ENV")
|
||||||
|
|
||||||
Mix.Generator.copy_file(
|
File.cp_r!(
|
||||||
"_build/docgen/#{profile}/emqx.conf.example",
|
"examples",
|
||||||
Path.join(etc, "emqx.conf.example"),
|
Path.join(etc, "examples"),
|
||||||
force: overwrite?
|
force: overwrite?
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -524,7 +524,7 @@ etc_overlay(ReleaseType, _Edition) ->
|
||||||
[
|
[
|
||||||
{mkdir, "etc/"},
|
{mkdir, "etc/"},
|
||||||
{copy, "{{base_dir}}/lib/emqx/etc/certs", "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(
|
lists:map(
|
||||||
fun
|
fun
|
||||||
|
|
Loading…
Reference in New Issue