You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mailu/nginx/start.py

14 lines
403 B
Python

#!/usr/bin/python
import jinja2
import os
import socket
convert = lambda src, dst: open(dst, "w").write(jinja2.Template(open(src).read()).render(**os.environ))
# Actual startup script
if "ADMIN_ADDRESS" not in os.environ:
os.environ["ADMIN_ADDRESS"] = socket.gethostbyname("admin")
convert("/conf/nginx.conf", "/etc/nginx/nginx.conf")
os.execv("/usr/sbin/nginx", ["nginx", "-g", "daemon off;"])