Merge pull request #6586 from zmstone/docs-explain-layered-config-at-the-top

docs: explain layered config at the top
This commit is contained in:
Zaiming (Stone) Shi 2021-12-31 08:10:15 +01:00 committed by GitHub
commit b09d0d8e4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 11 deletions

View File

@ -17,7 +17,7 @@
, {esockd, {git, "https://github.com/emqx/esockd", {tag, "5.9.0"}}}
, {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.11.2"}}}
, {gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.5.1"}}}
, {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.22.0"}}}
, {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.22.2"}}}
, {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {tag, "2.0.4"}}}
, {recon, {git, "https://github.com/ferd/recon", {tag, "2.5.1"}}}
, {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.16.0"}}}

View File

@ -2,6 +2,20 @@ EMQ X configuration file is in [HOCON](https://github.com/emqx/hocon) format.
HOCON, or Human-Optimized Config Object Notation is a format for human-readable data,
and a superset of JSON.
## Layered
EMQ X configuration consists of 3 layers.
From bottom up:
1. Immutable base: `emqx.conf` + `EMQX_` prfixed environment variables.<br>
Changes in this layer require a full node restart to take effect.
1. Cluster override: The path of which is configured by `cluster_override_conf_file`.<br>
Overrides made from management APIs (or dashboard) for all nodes in the cluster.
1. Local override: The path of which is configured by `local_override_conf_file`.<br>
Special overrides applied to local node.
For detailed override rules, see [Config overlay rules](#config-overlay-rules).
## Syntax
In config file the values can be notated as JSON like ojbects, such as
@ -12,7 +26,7 @@ node {
}
```
Another equivalent representation is flat, suh as
Another equivalent representation is flat, such as
```
node.name="127.0.0.1"
@ -117,17 +131,14 @@ because the field name is `enable`, not `enabled`.
<strong>NOTE:</strong> Unknown root keys are however silently discarded.
### Config overlay
### Config overlay rules
HOCON values are overlayed, earlier defined values are at layers closer to the bottom.
The overall order of the overlay rules from bottom up are:
HOCON objects are overlayed, in general:
1. `emqx.conf` the base config file
1. `EMQX_` prfixed environment variables
1. Cluster override file, the path of which is configured as `cluster_override_conf_file` in the lower layers
1. Local override file, the path of which is configured as `local_override_conf_file` in the lower layers
- Within one file, objects defined 'later' recursively override objects defined 'earlier'
- When layered, 'later' (hihger lalyer) objects override objects defined 'earlier' (lower layer)
Below are the rules of config value overlay.
Below are more detailed rules.
#### Struct Fileds

View File

@ -65,7 +65,7 @@
, {system_monitor, {git, "https://github.com/k32/system_monitor", {tag, "2.2.1"}}}
, {getopt, "1.0.2"}
, {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.16.0"}}}
, {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.22.0"}}}
, {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.22.2"}}}
, {emqx_http_lib, {git, "https://github.com/emqx/emqx_http_lib.git", {tag, "0.4.1"}}}
, {esasl, {git, "https://github.com/emqx/esasl", {tag, "0.2.0"}}}
, {jose, {git, "https://github.com/potatosalad/erlang-jose", {tag, "1.11.2"}}}