|
|
@@ -193,30 +193,30 @@ run_fold_hook(HookPoint, Args, Acc) ->
|
|
|
emqx_hooks:run_fold(HookPoint, Args, Acc).
|
|
|
|
|
|
-spec update_config(emqx_map_lib:config_key_path(), emqx_config:update_request()) ->
|
|
|
- {ok, emqx_config:config(), emqx_config:raw_config()} | {error, term()}.
|
|
|
+ {ok, emqx_config:update_result()} | {error, emqx_config:update_error()}.
|
|
|
update_config(KeyPath, UpdateReq) ->
|
|
|
update_config(KeyPath, UpdateReq, #{}).
|
|
|
|
|
|
-spec update_config(emqx_map_lib:config_key_path(), emqx_config:update_request(),
|
|
|
emqx_config:update_opts()) ->
|
|
|
- {ok, emqx_config:config(), emqx_config:raw_config()} | {error, term()}.
|
|
|
+ {ok, emqx_config:update_result()} | {error, emqx_config:update_error()}.
|
|
|
update_config([RootName | _] = KeyPath, UpdateReq, Opts) ->
|
|
|
emqx_config_handler:update_config(emqx_config:get_schema_mod(RootName), KeyPath,
|
|
|
{{update, UpdateReq}, Opts}).
|
|
|
|
|
|
-spec remove_config(emqx_map_lib:config_key_path()) ->
|
|
|
- {ok, emqx_config:config(), emqx_config:raw_config()} | {error, term()}.
|
|
|
+ {ok, emqx_config:update_result()} | {error, emqx_config:update_error()}.
|
|
|
remove_config(KeyPath) ->
|
|
|
remove_config(KeyPath, #{}).
|
|
|
|
|
|
-spec remove_config(emqx_map_lib:config_key_path(), emqx_config:update_opts()) ->
|
|
|
- ok | {error, term()}.
|
|
|
+ {ok, emqx_config:update_result()} | {error, emqx_config:update_error()}.
|
|
|
remove_config([RootName | _] = KeyPath, Opts) ->
|
|
|
emqx_config_handler:update_config(emqx_config:get_schema_mod(RootName),
|
|
|
KeyPath, {remove, Opts}).
|
|
|
|
|
|
-spec reset_config(emqx_map_lib:config_key_path(), emqx_config:update_opts()) ->
|
|
|
- {ok, emqx_config:config(), emqx_config:raw_config()} | {error, term()}.
|
|
|
+ {ok, emqx_config:update_result()} | {error, emqx_config:update_error()}.
|
|
|
reset_config([RootName | _] = KeyPath, Opts) ->
|
|
|
case emqx_config:get_default_value(KeyPath) of
|
|
|
{ok, Default} ->
|