Fix read plugin configuration not find schema file
This commit is contained in:
parent
7260b17cb5
commit
85f9a8cb70
|
@ -90,6 +90,10 @@ get(App, Par, Def) ->
|
||||||
read_(App) ->
|
read_(App) ->
|
||||||
Configs = emqttd_cli_config:read_config(App),
|
Configs = emqttd_cli_config:read_config(App),
|
||||||
Path = lists:concat([code:priv_dir(App), "/", App, ".schema"]),
|
Path = lists:concat([code:priv_dir(App), "/", App, ".schema"]),
|
||||||
|
case filelib:is_file(Path) of
|
||||||
|
false ->
|
||||||
|
[];
|
||||||
|
true ->
|
||||||
{_, Mappings, _} = cuttlefish_schema:files([Path]),
|
{_, Mappings, _} = cuttlefish_schema:files([Path]),
|
||||||
OptionalCfg = lists:foldl(fun(Map, Acc) ->
|
OptionalCfg = lists:foldl(fun(Map, Acc) ->
|
||||||
Key = cuttlefish_mapping:variable(Map),
|
Key = cuttlefish_mapping:variable(Map),
|
||||||
|
@ -106,4 +110,5 @@ read_(App) ->
|
||||||
[{cuttlefish_variable:format(Key), Val, cuttlefish_mapping:doc(Map), true} | Acc]
|
[{cuttlefish_variable:format(Key), Val, cuttlefish_mapping:doc(Map), true} | Acc]
|
||||||
end
|
end
|
||||||
end, [], Configs),
|
end, [], Configs),
|
||||||
RequiredCfg ++ OptionalCfg.
|
RequiredCfg ++ OptionalCfg
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue