fix(docker): cannot set log_level using os env
This commit is contained in:
parent
b9e3095ac3
commit
c9cf8b66e7
|
@ -1,7 +1,7 @@
|
||||||
EMQX_NAME=emqx
|
EMQX_NAME=emqx
|
||||||
EMQX_CLUSTER__DISCOVERY_STRATEGY=static
|
EMQX_CLUSTER__DISCOVERY_STRATEGY=static
|
||||||
EMQX_CLUSTER__STATIC__SEEDS="[emqx@node1.emqx.io, emqx@node2.emqx.io]"
|
EMQX_CLUSTER__STATIC__SEEDS="[emqx@node1.emqx.io, emqx@node2.emqx.io]"
|
||||||
EMQX_LISTENER__TCP__EXTERNAL__PROXY_PROTOCOL=on
|
EMQX_ZONES__DEFAULT__LISTENERS__MQTT_TCP__PROXY_PROTOCOL=true
|
||||||
EMQX_LISTENER__WS__EXTERNAL__PROXY_PROTOCOL=on
|
EMQX_ZONES__DEFAULT__LISTENERS__MQTT_WS__PROXY_PROTOCOL=true
|
||||||
EMQX_LOG__LEVEL=debug
|
EMQX_LOG__CONSOLE_HANDLER__ENABLE=true
|
||||||
EMQX_LOADED_PLUGINS=emqx_sn
|
EMQX_LOG__PRIMARY_LEVEL=debug
|
||||||
|
|
|
@ -325,7 +325,7 @@ log {
|
||||||
## Note: Only the messages with severity level higher than or
|
## Note: Only the messages with severity level higher than or
|
||||||
## equal to this level will be logged.
|
## equal to this level will be logged.
|
||||||
##
|
##
|
||||||
## @doc log.level
|
## @doc log.primary_level
|
||||||
## ValueType: debug | info | notice | warning | error | critical | alert | emergency
|
## ValueType: debug | info | notice | warning | error | critical | alert | emergency
|
||||||
## Default: warning
|
## Default: warning
|
||||||
primary_level: warning
|
primary_level: warning
|
||||||
|
|
|
@ -506,7 +506,7 @@ fields("alarm") ->
|
||||||
];
|
];
|
||||||
|
|
||||||
fields(ExtraField) ->
|
fields(ExtraField) ->
|
||||||
Mod = list_to_atom(ExtraField++"_schema"),
|
Mod = to_atom(ExtraField++"_schema"),
|
||||||
Mod:fields(ExtraField).
|
Mod:fields(ExtraField).
|
||||||
|
|
||||||
mqtt_listener() ->
|
mqtt_listener() ->
|
||||||
|
@ -649,7 +649,7 @@ filter(Opts) ->
|
||||||
%% , {"server_name_indication", undefined, undefined)}
|
%% , {"server_name_indication", undefined, undefined)}
|
||||||
%% ...]
|
%% ...]
|
||||||
ssl(Defaults) ->
|
ssl(Defaults) ->
|
||||||
D = fun (Field) -> maps:get(list_to_atom(Field), Defaults, undefined) end,
|
D = fun (Field) -> maps:get(to_atom(Field), Defaults, undefined) end,
|
||||||
[ {"enable", t(boolean(), undefined, D("enable"))}
|
[ {"enable", t(boolean(), undefined, D("enable"))}
|
||||||
, {"cacertfile", t(string(), undefined, D("cacertfile"))}
|
, {"cacertfile", t(string(), undefined, D("cacertfile"))}
|
||||||
, {"certfile", t(string(), undefined, D("certfile"))}
|
, {"certfile", t(string(), undefined, D("certfile"))}
|
||||||
|
@ -793,7 +793,7 @@ to_comma_separated_list(Str) ->
|
||||||
{ok, string:tokens(Str, ", ")}.
|
{ok, string:tokens(Str, ", ")}.
|
||||||
|
|
||||||
to_comma_separated_atoms(Str) ->
|
to_comma_separated_atoms(Str) ->
|
||||||
{ok, lists:map(fun list_to_atom/1, string:tokens(Str, ", "))}.
|
{ok, lists:map(fun to_atom/1, string:tokens(Str, ", "))}.
|
||||||
|
|
||||||
to_bar_separated_list(Str) ->
|
to_bar_separated_list(Str) ->
|
||||||
{ok, string:tokens(Str, "| ")}.
|
{ok, string:tokens(Str, "| ")}.
|
||||||
|
@ -815,7 +815,7 @@ to_erl_cipher_suite(Str) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
options(static, Conf) ->
|
options(static, Conf) ->
|
||||||
[{seeds, [list_to_atom(S) || S <- conf_get("cluster.static.seeds", Conf, [])]}];
|
[{seeds, [to_atom(S) || S <- conf_get("cluster.static.seeds", Conf, [])]}];
|
||||||
options(mcast, Conf) ->
|
options(mcast, Conf) ->
|
||||||
{ok, Addr} = inet:parse_address(conf_get("cluster.mcast.addr", Conf)),
|
{ok, Addr} = inet:parse_address(conf_get("cluster.mcast.addr", Conf)),
|
||||||
{ok, Iface} = inet:parse_address(conf_get("cluster.mcast.iface", Conf)),
|
{ok, Iface} = inet:parse_address(conf_get("cluster.mcast.iface", Conf)),
|
||||||
|
@ -830,7 +830,7 @@ options(etcd, Conf) ->
|
||||||
Namespace = "cluster.etcd.ssl",
|
Namespace = "cluster.etcd.ssl",
|
||||||
SslOpts = fun(C) ->
|
SslOpts = fun(C) ->
|
||||||
Options = keys(Namespace, C),
|
Options = keys(Namespace, C),
|
||||||
lists:map(fun(Key) -> {list_to_atom(Key), conf_get([Namespace, Key], Conf)} end, Options) end,
|
lists:map(fun(Key) -> {to_atom(Key), conf_get([Namespace, Key], Conf)} end, Options) end,
|
||||||
[{server, conf_get("cluster.etcd.server", Conf)},
|
[{server, conf_get("cluster.etcd.server", Conf)},
|
||||||
{prefix, conf_get("cluster.etcd.prefix", Conf, "emqxcl")},
|
{prefix, conf_get("cluster.etcd.prefix", Conf, "emqxcl")},
|
||||||
{node_ttl, conf_get("cluster.etcd.node_ttl", Conf, 60)},
|
{node_ttl, conf_get("cluster.etcd.node_ttl", Conf, 60)},
|
||||||
|
@ -844,3 +844,12 @@ options(k8s, Conf) ->
|
||||||
{suffix, conf_get("cluster.k8s.suffix", Conf, "")}];
|
{suffix, conf_get("cluster.k8s.suffix", Conf, "")}];
|
||||||
options(manual, _Conf) ->
|
options(manual, _Conf) ->
|
||||||
[].
|
[].
|
||||||
|
|
||||||
|
to_atom(#{value := Val}= _RichMap) ->
|
||||||
|
to_atom(Val);
|
||||||
|
to_atom(Atom) when is_atom(Atom) ->
|
||||||
|
Atom;
|
||||||
|
to_atom(Str) when is_list(Str) ->
|
||||||
|
list_to_atom(Str);
|
||||||
|
to_atom(Bin) when is_binary(Bin) ->
|
||||||
|
list_to_atom(binary_to_list(Bin)).
|
||||||
|
|
|
@ -214,7 +214,7 @@ Let's create a static node list cluster from docker-compose.
|
||||||
- "EMQX_NAME=emqx"
|
- "EMQX_NAME=emqx"
|
||||||
- "EMQX_HOST=node1.emqx.io"
|
- "EMQX_HOST=node1.emqx.io"
|
||||||
- "EMQX_CLUSTER__DISCOVERY_STRATEGY=static"
|
- "EMQX_CLUSTER__DISCOVERY_STRATEGY=static"
|
||||||
- "EMQX_CLUSTER__STATIC__SEEDS=emqx@node1.emqx.io, emqx@node2.emqx.io"
|
- "EMQX_CLUSTER__STATIC__SEEDS=[emqx@node1.emqx.io, emqx@node2.emqx.io]"
|
||||||
networks:
|
networks:
|
||||||
emqx-bridge:
|
emqx-bridge:
|
||||||
aliases:
|
aliases:
|
||||||
|
@ -226,7 +226,7 @@ Let's create a static node list cluster from docker-compose.
|
||||||
- "EMQX_NAME=emqx"
|
- "EMQX_NAME=emqx"
|
||||||
- "EMQX_HOST=node2.emqx.io"
|
- "EMQX_HOST=node2.emqx.io"
|
||||||
- "EMQX_CLUSTER__DISCOVERY_STRATEGY=static"
|
- "EMQX_CLUSTER__DISCOVERY_STRATEGY=static"
|
||||||
- "EMQX_CLUSTER__STATIC__SEEDS=emqx@node1.emqx.io, emqx@node2.emqx.io"
|
- "EMQX_CLUSTER__STATIC__SEEDS=[emqx@node1.emqx.io, emqx@node2.emqx.io]"
|
||||||
networks:
|
networks:
|
||||||
emqx-bridge:
|
emqx-bridge:
|
||||||
aliases:
|
aliases:
|
||||||
|
|
Loading…
Reference in New Issue