|
|
@@ -1235,8 +1235,7 @@ ensure_config_map(NameVsn) ->
|
|
|
{ok, ConfigJsonMap} ->
|
|
|
case with_plugin_avsc(NameVsn) of
|
|
|
true ->
|
|
|
- {ok, AvroValue} = decode_plugin_config_map(NameVsn, ConfigJsonMap),
|
|
|
- put_config(NameVsn, ConfigJsonMap, AvroValue);
|
|
|
+ do_ensure_config_map(NameVsn, ConfigJsonMap);
|
|
|
false ->
|
|
|
put_config(NameVsn, ConfigJsonMap, ?plugin_without_config_schema)
|
|
|
end;
|
|
|
@@ -1245,6 +1244,19 @@ ensure_config_map(NameVsn) ->
|
|
|
ok
|
|
|
end.
|
|
|
|
|
|
+do_ensure_config_map(NameVsn, ConfigJsonMap) ->
|
|
|
+ case decode_plugin_config_map(NameVsn, ConfigJsonMap) of
|
|
|
+ {ok, AvroValue} ->
|
|
|
+ put_config(NameVsn, ConfigJsonMap, AvroValue);
|
|
|
+ {error, Reason} ->
|
|
|
+ ?SLOG(error, #{
|
|
|
+ msg => "plugin_config_validation_failed",
|
|
|
+ name_vsn => NameVsn,
|
|
|
+ reason => Reason
|
|
|
+ }),
|
|
|
+ ok
|
|
|
+ end.
|
|
|
+
|
|
|
%% @private Backup the current config to a file with a timestamp suffix and
|
|
|
%% then save the new config to the config file.
|
|
|
backup_and_write_hocon_bin(NameVsn, HoconBin) ->
|