Browse Source

Add support for custom_templates folder to override Jinja2 templates

FreddleSpl0it 3 months ago
parent
commit
13b4f86d29

+ 4 - 1
data/Dockerfiles/bootstrap/modules/BootstrapClamd.py

@@ -31,7 +31,10 @@ class Bootstrap(BootstrapBase):
 
     # Setup Jinja2 Environment and load vars
     self.env = Environment(
-      loader=FileSystemLoader('/etc/clamav/config_templates'),
+      loader=FileSystemLoader([
+        '/etc/clamav/custom_templates',
+        '/etc/clamav/config_templates'
+      ]),
       keep_trailing_newline=True,
       lstrip_blocks=True,
       trim_blocks=True

+ 4 - 1
data/Dockerfiles/bootstrap/modules/BootstrapDovecot.py

@@ -30,7 +30,10 @@ class Bootstrap(BootstrapBase):
 
     # Setup Jinja2 Environment and load vars
     self.env = Environment(
-      loader=FileSystemLoader('/etc/dovecot/config_templates'),
+      loader=FileSystemLoader([
+        '/etc/dovecot/custom_templates',
+        '/etc/dovecot/config_templates'
+      ]),
       keep_trailing_newline=True,
       lstrip_blocks=True,
       trim_blocks=True

+ 4 - 1
data/Dockerfiles/bootstrap/modules/BootstrapMysql.py

@@ -30,7 +30,10 @@ class Bootstrap(BootstrapBase):
 
     # Setup Jinja2 Environment and load vars
     self.env = Environment(
-      loader=FileSystemLoader('/etc/mysql/conf.d/config_templates'),
+      loader=FileSystemLoader([
+        '/etc/mysql/conf.d/custom_templates',
+        '/etc/mysql/conf.d/config_templates'
+      ]),
       keep_trailing_newline=True,
       lstrip_blocks=True,
       trim_blocks=True

+ 4 - 1
data/Dockerfiles/bootstrap/modules/BootstrapNginx.py

@@ -22,7 +22,10 @@ class Bootstrap(BootstrapBase):
 
     # Setup Jinja2 Environment and load vars
     self.env = Environment(
-      loader=FileSystemLoader('/etc/nginx/conf.d/config_templates'),
+      loader=FileSystemLoader([
+        '/etc/nginx/conf.d/custom_templates',
+        '/etc/nginx/conf.d/config_templates'
+      ]),
       keep_trailing_newline=True,
       lstrip_blocks=True,
       trim_blocks=True

+ 4 - 1
data/Dockerfiles/bootstrap/modules/BootstrapPhpfpm.py

@@ -15,7 +15,10 @@ class Bootstrap(BootstrapBase):
 
     # Setup Jinja2 Environment and load vars
     self.env = Environment(
-      loader=FileSystemLoader('/php-conf/config_templates'),
+      loader=FileSystemLoader([
+        '/php-conf/custom_templates',
+        '/php-conf/config_templates'
+      ]),
       keep_trailing_newline=True,
       lstrip_blocks=True,
       trim_blocks=True

+ 4 - 1
data/Dockerfiles/bootstrap/modules/BootstrapPostfix.py

@@ -17,7 +17,10 @@ class Bootstrap(BootstrapBase):
 
     # Setup Jinja2 Environment and load vars
     self.env = Environment(
-      loader=FileSystemLoader('/opt/postfix/conf/config_templates'),
+      loader=FileSystemLoader([
+        '/opt/postfix/conf/custom_templates',
+        '/opt/postfix/conf/config_templates'
+      ]),
       keep_trailing_newline=True,
       lstrip_blocks=True,
       trim_blocks=True

+ 4 - 1
data/Dockerfiles/bootstrap/modules/BootstrapRspamd.py

@@ -60,7 +60,10 @@ class Bootstrap(BootstrapBase):
 
     # Setup Jinja2 Environment and load vars
     self.env = Environment(
-      loader=FileSystemLoader('/etc/rspamd/config_templates'),
+      loader=FileSystemLoader([
+        '/etc/rspamd/custom_templates',
+        '/etc/rspamd/config_templates'
+      ]),
       keep_trailing_newline=True,
       lstrip_blocks=True,
       trim_blocks=True

+ 4 - 1
data/Dockerfiles/bootstrap/modules/BootstrapSogo.py

@@ -27,7 +27,10 @@ class Bootstrap(BootstrapBase):
 
     # Setup Jinja2 Environment and load vars
     self.env = Environment(
-      loader=FileSystemLoader("/etc/sogo/config_templates"),
+      loader=FileSystemLoader([
+        '/etc/sogo/custom_templates',
+        '/etc/sogo/config_templates'
+      ]),
       keep_trailing_newline=True,
       lstrip_blocks=True,
       trim_blocks=True

+ 0 - 0
data/conf/clamav/custom_templates/.gitkeep


+ 0 - 0
data/conf/dovecot/custom_templates/.gitkeep


+ 0 - 0
data/conf/mysql/custom_templates/.gitkeep


+ 0 - 0
data/conf/nginx/custom_templates/.gitkeep


+ 0 - 0
data/conf/phpfpm/custom_templates/.gitkeep


+ 0 - 0
data/conf/postfix/custom_templates/.gitkeep


+ 0 - 0
data/conf/rspamd/custom_templates/.gitkeep


+ 0 - 0
data/conf/sogo/custom_templates/.gitkeep