From cab2d44df5c1854d5f5dbce6e627a35565b4d8ef Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Sun, 21 Feb 2021 10:06:11 +0530 Subject: [PATCH] perf: Remove bench.config.letsencrypt from the import tree --- bench/commands/setup.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bench/commands/setup.py b/bench/commands/setup.py index 87b0d5b7..21dfdafa 100755 --- a/bench/commands/setup.py +++ b/bench/commands/setup.py @@ -6,9 +6,7 @@ import sys import click # imports - module imports -import bench.config.lets_encrypt import bench.config.procfile -import bench.config.production_setup import bench.config.redis import bench.config.site_config import bench.config.supervisor @@ -37,6 +35,8 @@ def setup_nginx(yes=False): @click.command("reload-nginx", help="Checks NGINX config file and reloads service") def reload_nginx(): + import bench.config.production_setup + bench.config.production_setup.reload_nginx() @@ -62,6 +62,8 @@ def setup_fonts(): @click.argument("user") @click.option("--yes", help="Yes to regeneration config", is_flag=True, default=False) def setup_production(user, yes=False): + import bench.config.production_setup + bench.config.production_setup.setup_production(user=user, yes=yes) @@ -104,6 +106,8 @@ def set_ssh_port(port, force=False): @click.option("--custom-domain") @click.option('-n', '--non-interactive', default=False, is_flag=True, help="Run command non-interactively. This flag restarts nginx and runs certbot non interactively. Shouldn't be used on 1'st attempt") def setup_letsencrypt(site, custom_domain, non_interactive): + import bench.config.lets_encrypt + bench.config.lets_encrypt.setup_letsencrypt(site, custom_domain, bench_path=".", interactive=not non_interactive) @@ -112,6 +116,8 @@ def setup_letsencrypt(site, custom_domain, non_interactive): @click.option("--email") @click.option("--exclude-base-domain", default=False, is_flag=True, help="SSL Certificate not applicable for base domain") def setup_wildcard_ssl(domain, email, exclude_base_domain): + import bench.config.lets_encrypt + bench.config.lets_encrypt.setup_wildcard_ssl(domain, email, bench_path=".", exclude_base_domain=exclude_base_domain)