Add gmconfig:pure_update_config/3 (#4)
The function `pure_update_config/3` updates the config and simply returns the new config, without any side-effects. Co-authored-by: Ulf Wiger <ulf@wiger.net> Reviewed-on: #4
This commit was merged in pull request #4.
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
-export([update_config/1,
|
||||
update_config/2,
|
||||
update_config/3,
|
||||
pure_update_config/3,
|
||||
silent_update_config/1,
|
||||
delete_config_value/1,
|
||||
suggest_config/2,
|
||||
@@ -878,6 +879,12 @@ update_config(Map, ConfigMap, Mode) ->
|
||||
pt_set_config(ConfigMap1),
|
||||
ok.
|
||||
|
||||
pure_update_config(Map, ConfigMap, Schema) ->
|
||||
NewCfg = gmconfig_schema_utils:merge(Map, ConfigMap, Schema),
|
||||
check_validation([validate_(NewCfg, Schema)],
|
||||
[NewCfg], pure_update_config, silent),
|
||||
NewCfg.
|
||||
|
||||
export_config() ->
|
||||
Config = pt_get_config(),
|
||||
JSON = json:format(Config, #{indent => 2}),
|
||||
|
||||
Reference in New Issue
Block a user