mirror of
https://github.com/frappe/bench.git
synced 2025-01-10 09:02:10 +00:00
Added command to add custom domain
This commit is contained in:
parent
012be92f09
commit
ac60badb26
@ -1,4 +1,4 @@
|
|||||||
import click
|
import click, sys
|
||||||
|
|
||||||
@click.group()
|
@click.group()
|
||||||
def setup():
|
def setup():
|
||||||
@ -101,6 +101,28 @@ def setup_config():
|
|||||||
make_config('.')
|
make_config('.')
|
||||||
|
|
||||||
|
|
||||||
|
@click.command('domain')
|
||||||
|
@click.argument('domain')
|
||||||
|
@click.option('--site')
|
||||||
|
@click.option('--ssl-certificate-path', help="Path to SSL certificate")
|
||||||
|
@click.option('--ssl-certificate-key', help="Path to SSL certificate key")
|
||||||
|
def setup_domain(site, domain, ssl_certificate_path=None, ssl_certificate_key=None):
|
||||||
|
"Add custom domain to site"
|
||||||
|
from bench.utils import get_site_domains, update_site_domains
|
||||||
|
if not site:
|
||||||
|
print "Please specify site"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
domains = get_site_domains(site)
|
||||||
|
if ssl_certificate_key and ssl_certificate_path:
|
||||||
|
domain = {
|
||||||
|
'domain' : domain,
|
||||||
|
'ssl_certificate_path': ssl_certificate_path,
|
||||||
|
'ssl_certificate_key': ssl_certificate_key
|
||||||
|
}
|
||||||
|
update_site_domains(site, domain)
|
||||||
|
|
||||||
|
|
||||||
setup.add_command(setup_sudoers)
|
setup.add_command(setup_sudoers)
|
||||||
setup.add_command(setup_nginx)
|
setup.add_command(setup_nginx)
|
||||||
setup.add_command(setup_supervisor)
|
setup.add_command(setup_supervisor)
|
||||||
@ -114,3 +136,4 @@ setup.add_command(setup_procfile)
|
|||||||
setup.add_command(setup_socketio)
|
setup.add_command(setup_socketio)
|
||||||
setup.add_command(setup_config)
|
setup.add_command(setup_config)
|
||||||
setup.add_command(setup_fonts)
|
setup.add_command(setup_fonts)
|
||||||
|
setup.add_command(setup_domain)
|
||||||
|
@ -339,6 +339,14 @@ def update_site_config(site, new_config, bench_path='.'):
|
|||||||
config.update(new_config)
|
config.update(new_config)
|
||||||
put_site_config(site, config, bench_path=bench_path)
|
put_site_config(site, config, bench_path=bench_path)
|
||||||
|
|
||||||
|
def get_site_domains(site, bench_path='.'):
|
||||||
|
return get_site_config(site, bench_path).get("domains") or []
|
||||||
|
|
||||||
|
def update_site_domains(site, domain, bench_path='.'):
|
||||||
|
domains = get_site_domains(site, bench_path)
|
||||||
|
domains.append(domain)
|
||||||
|
update_site_config(site, {"domains": domains})
|
||||||
|
|
||||||
def set_nginx_port(site, port, bench_path='.', gen_config=True):
|
def set_nginx_port(site, port, bench_path='.', gen_config=True):
|
||||||
set_site_config_nginx_property(site, {"nginx_port": port}, bench_path=bench_path, gen_config=gen_config)
|
set_site_config_nginx_property(site, {"nginx_port": port}, bench_path=bench_path, gen_config=gen_config)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user