Verified Commit 14f7c2c1 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Allow entrypoint to pass flags and options to master

parent 005c7afb
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ Entrypoint script for the Postfix Docker image

from __future__ import annotations

import sys
from collections.abc import Iterator
from os import environ
from os import execv
@@ -34,7 +35,7 @@ def as_arguments(options: dict[str, str]) -> Iterator[str]:
		yield f"{name}={value}"


if len(argv) > 1:
if len(argv) > 1 and not argv[1].startswith("-"):
	execvp(argv[1], argv[1:])

if (hostname := environ.get("MTA_HOSTNAME")):
@@ -46,4 +47,4 @@ with MAIN_CONF.open("x", encoding=ENCODING, errors=ERRORS) as conf:
		conf.write("\n")  # Ensure the last line is terminated

run(["/usr/sbin/postconf", *as_arguments(options)])
execv("/usr/lib/postfix/sbin/master", ["master", "-i"])
execv("/usr/lib/postfix/sbin/master", ["master", "-i"] + sys.argv[1:])