add config backward compatibility

This commit is contained in:
2021-03-10 00:20:36 +01:00
parent ea890591c3
commit c854b74f96

View File

@@ -365,11 +365,19 @@ class ActionConfig(BaseConfig):
if self["type"] == "add_header":
self["func"] = add_header
self["need_body"] = False
if not "field" in cfg and "header" in cfg:
cfg["field"] = cfg["header"]
self.add_string_arg(cfg, ("field", "value"))
elif self["type"] == "mod_header":
self["func"] = mod_header
self["need_body"] = False
if not "field" in cfg and "header" in cfg:
cfg["field"] = cfg["header"]
args = ["field", "value"]
if "search" in cfg:
args.append("search")
@@ -387,6 +395,10 @@ class ActionConfig(BaseConfig):
elif self["type"] == "del_header":
self["func"] = del_header
self["need_body"] = False
if not "field" in cfg and "header" in cfg:
cfg["field"] = cfg["header"]
args = ["field"]
if "value" in cfg:
args.append("value")
@@ -404,6 +416,12 @@ class ActionConfig(BaseConfig):
self["func"] = add_disclaimer
self["need_body"] = True
if not "html_template" in cfg and "html_file" in cfg:
cfg["html_template"] = cfg["html_file"]
if not "text_template" in cfg and "text_file" in cfg:
cfg["text_template"] = cfg["text_file"]
if "error_policy" not in cfg:
cfg["error_policy"] = "wrap"