1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-31 21:17:23 +02:00

migrate the SSL certificates path for non-primary certs to a new layout using a new migration script

This commit is contained in:
Joshua Tauberer
2014-06-30 20:41:29 +00:00
parent 06ba25151f
commit c8856f107d
5 changed files with 98 additions and 9 deletions

View File

@@ -1,16 +1,23 @@
import os.path
CONF_DIR = os.path.join(os.path.dirname(__file__), "../conf")
def load_environment():
# Load settings from /etc/mailinabox.conf.
import os.path
env = load_env_vars_from_file("/etc/mailinabox.conf")
env["CONF_DIR"] = os.path.join(os.path.dirname(__file__), "../conf")
return env
return load_env_vars_from_file("/etc/mailinabox.conf")
def load_env_vars_from_file(fn):
# Load settings from a KEY=VALUE file.
env = { }
import collections
env = collections.OrderedDict()
for line in open(fn): env.setdefault(*line.strip().split("=", 1))
return env
def save_environment(env):
with open("/etc/mailinabox.conf", "w") as f:
for k, v in env.items():
f.write("%s=%s\n" % (k, v))
def safe_domain_name(name):
# Sanitize a domain name so it is safe to use as a file name on disk.
import urllib.parse