mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
[#954] Fix templator missing some common configs
This commit is contained in:
parent
d0213c183b
commit
fb1ab27969
2 changed files with 5 additions and 14 deletions
|
|
@ -7,6 +7,7 @@
|
|||
- [BUGFIX] Fix Bad behavior whitelist check in access phase
|
||||
- [BUGFIX] Fix ModSecurity FP on antibot page
|
||||
- [BUGFIX] Fix Whitelist core plugin missing a check for empty server_name in multisite mode
|
||||
- [BUGFIX] Fix Templator missing some common configs
|
||||
- [LINUX] Add logrotate support for the logs
|
||||
- [UI] Add bans management page in the web UI
|
||||
- [UI] Add blocked requests page in the web UI
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ from jinja2 import Environment, FileSystemLoader
|
|||
class Templator:
|
||||
def __init__(self, templates: str, core: str, plugins: str, pro_plugins: str, output: str, target: str, config: Dict[str, Any]):
|
||||
self.__templates = templates
|
||||
self.__global_templates = [basename(template) for template in glob(join(self.__templates, "*", "*.conf"))]
|
||||
self.__core = core
|
||||
self.__plugins = plugins
|
||||
self.__pro_plugins = pro_plugins
|
||||
|
|
@ -36,9 +37,9 @@ class Templator:
|
|||
|
||||
def __load_jinja_env(self) -> Environment:
|
||||
searchpath = [self.__templates]
|
||||
for subpath in glob(join(self.__core, "*")) + glob(join(self.__plugins, "*")) + glob(join(self.__pro_plugins, "*")):
|
||||
for subpath in glob(join(self.__core, "*", "confs")) + glob(join(self.__plugins, "*", "confs")) + glob(join(self.__pro_plugins, "*", "confs")):
|
||||
if Path(subpath).is_dir():
|
||||
searchpath.append(join(subpath, "confs"))
|
||||
searchpath.append(subpath)
|
||||
return Environment(loader=FileSystemLoader(searchpath=searchpath), lstrip_blocks=True, trim_blocks=True)
|
||||
|
||||
def __find_templates(self, contexts) -> List[str]:
|
||||
|
|
@ -87,18 +88,7 @@ class Templator:
|
|||
if server_key not in self.__config:
|
||||
config["SERVER_NAME"] = server
|
||||
|
||||
for root_conf in (
|
||||
"server.conf",
|
||||
"access-lua.conf",
|
||||
"ssl-certificate-lua.conf",
|
||||
"header-lua.conf",
|
||||
"init-lua.conf",
|
||||
"log-lua.conf",
|
||||
"set-lua.conf",
|
||||
"log-stream-lua.conf",
|
||||
"preread-stream-lua.conf",
|
||||
"server-stream.conf",
|
||||
):
|
||||
for root_conf in self.__global_templates:
|
||||
if template.endswith(root_conf):
|
||||
name = basename(template)
|
||||
break
|
||||
|
|
|
|||
Loading…
Reference in a new issue