mirror of
https://github.com/zokradonh/kopano-docker.git
synced 2026-08-11 16:32:59 +00:00
Disable some checks when deploying with injected cfg files (#295)
* Add variables to disable some checks that aren't needed if you inject the cfg files * add tests for new functionality * uncomment write protected test fixes https://github.com/zokradonh/kopano-docker/pull/296
This commit is contained in:
+8
-3
@@ -4,6 +4,7 @@ via environment variables"""
|
||||
import re
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
|
||||
def configkopano(configs):
|
||||
""" Changes configuration files according to configs typically returned from parseenvironmentvariables(..)"""
|
||||
@@ -34,9 +35,13 @@ def configkopano(configs):
|
||||
contents = re.sub(r"^\s*#?\s*{}\s*=.*".format(key), r"{} = {}".format(key, newvalue), contents, 0, re.MULTILINE)
|
||||
|
||||
# save new configuration
|
||||
with open(filename, "w") as f:
|
||||
f.write(contents)
|
||||
f.close()
|
||||
try:
|
||||
with open(filename, "w") as f:
|
||||
f.write(contents)
|
||||
f.close()
|
||||
except (OSError, PermissionError):
|
||||
print("Can't open {}, ignoring file changes".format(filename))
|
||||
|
||||
|
||||
def parseenvironmentvariables(prependingpath):
|
||||
""" Parse all environment variables starting with KCCONF_, KCCOMMENT_ and KCUNCOMMENT_ and
|
||||
|
||||
Reference in New Issue
Block a user