|
|
@ -3,7 +3,7 @@
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import logging as log
|
|
|
|
import logging as log
|
|
|
|
import sys
|
|
|
|
import sys
|
|
|
|
from mailustart import resolve, convert
|
|
|
|
from socrate import system, conf
|
|
|
|
|
|
|
|
|
|
|
|
args = os.environ.copy()
|
|
|
|
args = os.environ.copy()
|
|
|
|
|
|
|
|
|
|
|
@ -14,14 +14,14 @@ with open("/etc/resolv.conf") as handle:
|
|
|
|
content = handle.read().split()
|
|
|
|
content = handle.read().split()
|
|
|
|
args["RESOLVER"] = content[content.index("nameserver") + 1]
|
|
|
|
args["RESOLVER"] = content[content.index("nameserver") + 1]
|
|
|
|
|
|
|
|
|
|
|
|
args["HOST_ADMIN"] = resolve(args.get("HOST_ADMIN", "admin"))
|
|
|
|
args["HOST_ADMIN"] = system.resolve_address(args.get("HOST_ADMIN", "admin"))
|
|
|
|
args["HOST_ANTISPAM"] = resolve(args.get("HOST_ANTISPAM", "antispam:11334"))
|
|
|
|
args["HOST_ANTISPAM"] = system.resolve_address(args.get("HOST_ANTISPAM", "antispam:11334"))
|
|
|
|
args["HOST_WEBMAIL"] = args.get("HOST_WEBMAIL", "webmail")
|
|
|
|
args["HOST_WEBMAIL"] = args.get("HOST_WEBMAIL", "webmail")
|
|
|
|
if args["WEBMAIL"] != "none":
|
|
|
|
if args["WEBMAIL"] != "none":
|
|
|
|
args["HOST_WEBMAIL"] = resolve(args.get("HOST_WEBMAIL"))
|
|
|
|
args["HOST_WEBMAIL"] = system.resolve_address(args.get("HOST_WEBMAIL"))
|
|
|
|
args["HOST_WEBDAV"] = args.get("HOST_WEBDAV", "webdav:5232")
|
|
|
|
args["HOST_WEBDAV"] = args.get("HOST_WEBDAV", "webdav:5232")
|
|
|
|
if args["WEBDAV"] != "none":
|
|
|
|
if args["WEBDAV"] != "none":
|
|
|
|
args["HOST_WEBDAV"] = resolve(args.get("HOST_WEBDAV"))
|
|
|
|
args["HOST_WEBDAV"] = system.resolve_address(args.get("HOST_WEBDAV"))
|
|
|
|
|
|
|
|
|
|
|
|
# TLS configuration
|
|
|
|
# TLS configuration
|
|
|
|
cert_name = os.getenv("TLS_CERT_FILENAME", default="cert.pem")
|
|
|
|
cert_name = os.getenv("TLS_CERT_FILENAME", default="cert.pem")
|
|
|
@ -41,8 +41,8 @@ if args["TLS"] and not all(os.path.exists(file_path) for file_path in args["TLS"
|
|
|
|
args["TLS_ERROR"] = "yes"
|
|
|
|
args["TLS_ERROR"] = "yes"
|
|
|
|
|
|
|
|
|
|
|
|
# Build final configuration paths
|
|
|
|
# Build final configuration paths
|
|
|
|
convert("/conf/tls.conf", "/etc/nginx/tls.conf", args)
|
|
|
|
conf.jinja("/conf/tls.conf", args, "/etc/nginx/tls.conf")
|
|
|
|
convert("/conf/proxy.conf", "/etc/nginx/proxy.conf", args)
|
|
|
|
conf.jinja("/conf/proxy.conf", args, "/etc/nginx/proxy.conf")
|
|
|
|
convert("/conf/nginx.conf", "/etc/nginx/nginx.conf", args)
|
|
|
|
conf.jinja("/conf/nginx.conf", args, "/etc/nginx/nginx.conf")
|
|
|
|
if os.path.exists("/var/run/nginx.pid"):
|
|
|
|
if os.path.exists("/var/run/nginx.pid"):
|
|
|
|
os.system("nginx -s reload")
|
|
|
|
os.system("nginx -s reload")
|
|
|
|