From ae290482c0e0b2401a180f4fd48fe9915acd98a6 Mon Sep 17 00:00:00 2001 From: Daniel Huber Date: Wed, 26 Jun 2019 20:22:02 +0200 Subject: [PATCH] Format relay credentials file with jinja --- core/postfix/conf/sasl_passwd | 1 + core/postfix/start.py | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) create mode 100644 core/postfix/conf/sasl_passwd diff --git a/core/postfix/conf/sasl_passwd b/core/postfix/conf/sasl_passwd new file mode 100644 index 00000000..e19d0657 --- /dev/null +++ b/core/postfix/conf/sasl_passwd @@ -0,0 +1 @@ +{{ RELAYHOST }} {{ RELAYUSER }}:{{ RELAYPASSWORD }} \ No newline at end of file diff --git a/core/postfix/start.py b/core/postfix/start.py index b7a3a853..81849c5b 100755 --- a/core/postfix/start.py +++ b/core/postfix/start.py @@ -50,9 +50,7 @@ for map_file in glob.glob("/overrides/*.map"): if "RELAYUSER" in os.environ: path = "/etc/postfix/sasl_passwd" - fileContent = "{} {}:{}".format(os.environ["RELAYHOST"], os.environ["RELAYUSER"], os.environ["RELAYPASSWORD"]) - with open(path, "w") as f: - f.write(fileContent) + convert("/conf/sasl_passwd", path) os.system("postmap {}".format(path)) convert("/conf/rsyslog.conf", "/etc/rsyslog.conf")