HOST_* and *_ADDRESS variables cleanup

master
Ionut Filip 6 years ago
parent 7885fb8a41
commit 4c25c83419

@ -83,11 +83,11 @@ class ConfigManager(dict):
self.config = dict()
def resolve_host(self):
self.config['HOST_IMAP'] = resolve(self.config['HOST_IMAP'])
self.config['HOST_POP3'] = resolve(self.config['HOST_POP3'])
self.config['HOST_AUTHSMTP'] = resolve(self.config['HOST_AUTHSMTP'])
self.config['HOST_SMTP'] = resolve(self.config['HOST_SMTP'])
self.config['HOST_REDIS'] = resolve(self.config['HOST_REDIS'])
self.config['IMAP_ADDRESS'] = resolve(self.config['HOST_IMAP'])
self.config['POP3_ADDRESS'] = resolve(self.config['HOST_POP3'])
self.config['AUTHSMTP_ADDRESS'] = resolve(self.config['HOST_AUTHSMTP'])
self.config['SMTP_ADDRESS'] = resolve(self.config['HOST_SMTP'])
self.config['REDIS_ADDRESS'] = resolve(self.config['HOST_REDIS'])
def __coerce_value(self, value):
if isinstance(value, str) and value.lower() in ('true','yes'):
@ -111,8 +111,8 @@ class ConfigManager(dict):
template = self.DB_TEMPLATES[self.config['DB_FLAVOR']]
self.config['SQLALCHEMY_DATABASE_URI'] = template.format(**self.config)
self.config['RATELIMIT_STORAGE_URL'] = 'redis://{0}/2'.format(self.config['HOST_REDIS'])
self.config['QUOTA_STORAGE_URL'] = 'redis://{0}/1'.format(self.config['HOST_REDIS'])
self.config['RATELIMIT_STORAGE_URL'] = 'redis://{0}/2'.format(self.config['REDIS_ADDRESS'])
self.config['QUOTA_STORAGE_URL'] = 'redis://{0}/1'.format(self.config['REDIS_ADDRESS'])
# update the app config itself
app.config = self

@ -41,10 +41,10 @@ http {
# Favicon stuff
root /static;
# Variables for proxifying
set $admin {{ HOST_ADMIN }};
set $antispam {{ HOST_ANTISPAM }};
set $webmail {{ HOST_WEBMAIL }};
set $webdav {{ HOST_WEBDAV }};
set $admin {{ ADMIN_ADDRESS }};
set $antispam {{ ANTISPAM_ADDRESS }};
set $webmail {{ WEBMAIL_ADDRESS }};
set $webdav {{ WEBDAV_ADDRESS }};
# Always listen over HTTP
listen 80;
@ -168,7 +168,7 @@ http {
# Forwarding authentication server
server {
# Variables for proxifying
set $admin {{ HOST_ADMIN }};
set $admin {{ ADMIN_ADDRESS }};
listen 127.0.0.1:8000;

@ -14,14 +14,14 @@ with open("/etc/resolv.conf") as handle:
content = handle.read().split()
args["RESOLVER"] = content[content.index("nameserver") + 1]
args["HOST_ADMIN"] = resolve(args.get("HOST_ADMIN", "admin"))
args["HOST_ANTISPAM"] = resolve(args.get("HOST_ANTISPAM", "antispam:11334"))
args["ADMIN_ADDRESS"] = resolve(args.get("HOST_ADMIN", "admin"))
args["ANTISPAM_ADDRESS"] = resolve(args.get("HOST_ANTISPAM", "antispam:11334"))
args["HOST_WEBMAIL"] = args.get("HOST_WEBMAIL", "webmail")
if args["WEBMAIL"] != "none":
args["HOST_WEBMAIL"] = resolve(args.get("HOST_WEBMAIL"))
args["WEBMAIL_ADDRESS"] = resolve(args.get("HOST_WEBMAIL"))
args["HOST_WEBDAV"] = args.get("HOST_WEBDAV", "webdav:5232")
if args["WEBDAV"] != "none":
args["HOST_WEBDAV"] = resolve(args.get("HOST_WEBDAV"))
args["WEBDAV_ADDRESS"] = resolve(args.get("HOST_WEBDAV"))
# TLS configuration
cert_name = os.getenv("TLS_CERT_FILENAME", default="cert.pem")

@ -65,7 +65,7 @@ virtual_mailbox_maps = ${podop}mailbox
# Mails are transported if required, then forwarded to Dovecot for delivery
relay_domains = ${podop}transport
transport_maps = ${podop}transport
virtual_transport = lmtp:inet:{{ HOST_LMTP }}
virtual_transport = lmtp:inet:{{ LMTP_ADDRESS }}
# In order to prevent Postfix from running DNS query, enforce the use of the
# native DNS stack, that will check /etc/hosts properly.
@ -104,7 +104,7 @@ unverified_recipient_reject_reason = Address lookup failure
# Milter
###############
smtpd_milters = inet:{{ HOST_ANTISPAM }}
smtpd_milters = inet:{{ ANTISPAM_ADDRESS }}
milter_protocol = 6
milter_mail_macros = i {mail_addr} {client_addr} {client_name} {auth_authen}
milter_default_action = tempfail

@ -28,8 +28,8 @@ def start_podop():
# Actual startup script
os.environ["FRONT_ADDRESS"] = resolve(os.environ.get("HOST_FRONT", "front"))
os.environ["ADMIN_ADDRESS"] = resolve(os.environ.get("HOST_ADMIN", "admin"))
os.environ["HOST_ANTISPAM"] = resolve(os.environ.get("HOST_ANTISPAM", "antispam:11332"))
os.environ["HOST_LMTP"] = resolve(os.environ.get("HOST_LMTP", "imap:2525"))
os.environ["ANTISPAM_ADDRESS"] = resolve(os.environ.get("HOST_ANTISPAM", "antispam:11332"))
os.environ["LMTP_ADDRESS"] = resolve(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)))

@ -1 +1 @@
servers = "{{ HOST_REDIS }}";
servers = "{{ REDIS_ADDRESS }}";

@ -1 +1 @@
servers = "{{ HOST_REDIS }}";
servers = "{{ REDIS_ADDRESS }}";

@ -10,7 +10,7 @@ log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING"))
# Actual startup script
os.environ["FRONT_ADDRESS"] = resolve(os.environ.get("HOST_FRONT", "front"))
os.environ["HOST_REDIS"] = resolve(os.environ.get("HOST_REDIS", "redis"))
os.environ["REDIS_ADDRESS"] = resolve(os.environ.get("HOST_REDIS", "redis"))
for rspamd_file in glob.glob("/conf/*"):
convert(rspamd_file, os.path.join("/etc/rspamd/local.d", os.path.basename(rspamd_file)))

Loading…
Cancel
Save