1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-19 18:17:22 +01:00

add instructions for static web hosting into the control panel

This commit is contained in:
Joshua Tauberer
2014-10-07 16:05:38 +00:00
parent bf9b770255
commit 6ab29c3244
4 changed files with 127 additions and 2 deletions

View File

@@ -113,11 +113,11 @@ def make_domain_config(domain, template, template_for_primaryhost, env):
return nginx_conf
def get_web_root(domain, env):
def get_web_root(domain, env, test_exists=True):
# Try STORAGE_ROOT/web/domain_name if it exists, but fall back to STORAGE_ROOT/web/default.
for test_domain in (domain, 'default'):
root = os.path.join(env["STORAGE_ROOT"], "www", safe_domain_name(test_domain))
if os.path.exists(root): break
if os.path.exists(root) or not test_exists: break
return root
def get_domain_ssl_files(domain, env):
@@ -193,3 +193,12 @@ def ensure_ssl_certificate_exists(domain, ssl_key, ssl_certificate, csr_path, en
"-signkey", ssl_key,
"-out", ssl_certificate])
def get_web_domains_info(env):
return [
{
"domain": domain,
"root": get_web_root(domain, env),
"custom_root": get_web_root(domain, env, test_exists=False),
}
for domain in get_web_domains(env)
]