mirror of
https://github.com/frappe/bench.git
synced 2024-11-11 15:51:03 +00:00
Add config option to switch off default site serving, fix #38
This commit is contained in:
parent
fedf007a11
commit
7f10e0c020
@ -225,6 +225,13 @@ def config_dns_multitenant(state):
|
||||
state = True if state == 'on' else False
|
||||
update_config({'dns_multitenant': state})
|
||||
|
||||
@click.command('serve_default_site')
|
||||
@click.argument('state', type=click.Choice(['on', 'off']))
|
||||
def config_dns_multitenant(state):
|
||||
"Configure nginx to serve the default site on port 80"
|
||||
state = True if state == 'on' else False
|
||||
update_config({'serve_default_site': state})
|
||||
|
||||
config.add_command(config_auto_update)
|
||||
config.add_command(config_update_bench_on_update)
|
||||
config.add_command(config_restart_supervisor_on_update)
|
||||
|
@ -12,8 +12,6 @@ def generate_supervisor_config(bench='.'):
|
||||
sites_dir = os.path.join(bench_dir, "sites")
|
||||
sites = get_sites(bench=bench)
|
||||
user = getpass.getuser()
|
||||
with open("sites/currentsite.txt") as f:
|
||||
default_site = f.read().strip()
|
||||
|
||||
config = template.render(**{
|
||||
"bench_dir": bench_dir,
|
||||
@ -40,11 +38,15 @@ def generate_nginx_config(bench='.'):
|
||||
sites_dir = os.path.join(bench_dir, "sites")
|
||||
sites = get_sites_with_config(bench=bench)
|
||||
user = getpass.getuser()
|
||||
with open("sites/currentsite.txt") as f:
|
||||
default_site = f.read().strip()
|
||||
default_site = {
|
||||
'name': default_site
|
||||
}
|
||||
|
||||
if get_config().get('serve_default_site'):
|
||||
try:
|
||||
with open("sites/currentsite.txt") as f:
|
||||
default_site = {'name': f.read().strip()}
|
||||
except IOError:
|
||||
default_site = None
|
||||
else:
|
||||
default_site = None
|
||||
|
||||
config = template.render(**{
|
||||
"sites_dir": sites_dir,
|
||||
|
Loading…
Reference in New Issue
Block a user