Add various environment variables to allow running outside of docker-compose

This commit is contained in:
Mildred Ki'Lya
2018-01-31 22:24:54 +01:00
parent d4cc142f64
commit ae8c9f5a6b
10 changed files with 46 additions and 17 deletions

View File

@@ -9,7 +9,9 @@ import shutil
convert = lambda src, dst: open(dst, "w").write(jinja2.Template(open(src).read()).render(**os.environ))
# Actual startup script
os.environ["FRONT_ADDRESS"] = socket.gethostbyname("front")
os.environ["FRONT_ADDRESS"] = socket.gethostbyname(os.environ.get("FRONT_ADDRESS", "front"))
os.environ["HOST_ANTISPAM"] = os.environ.get("HOST_ANTISPAM", "antispam:11332")
os.environ["HOST_LMTP"] = os.environ.get("HOST_LMTP", "imap:2525")
for postfix_file in glob.glob("/conf/*.cf"):
convert(postfix_file, os.path.join("/etc/postfix", os.path.basename(postfix_file)))