diff options
| author | crupest <crupest@outlook.com> | 2022-11-20 15:27:20 +0800 | 
|---|---|---|
| committer | crupest <crupest@outlook.com> | 2022-11-20 15:27:20 +0800 | 
| commit | 839e518e0a0cc9ae15692e541a6c79106d223f12 (patch) | |
| tree | af8b18db5bdb540c589f36f090876d2b5eaaa43a /tool/modules | |
| parent | 4e6dcdc7c56e65cb8d69e35ec0b0ebc5a47f940c (diff) | |
| download | crupest-839e518e0a0cc9ae15692e541a6c79106d223f12.tar.gz crupest-839e518e0a0cc9ae15692e541a6c79106d223f12.tar.bz2 crupest-839e518e0a0cc9ae15692e541a6c79106d223f12.zip  | |
Continue to fix nginx.
Diffstat (limited to 'tool/modules')
| -rwxr-xr-x | tool/modules/nginx.py | 8 | 
1 files changed, 6 insertions, 2 deletions
diff --git a/tool/modules/nginx.py b/tool/modules/nginx.py index ebbbee5..398f6f7 100755 --- a/tool/modules/nginx.py +++ b/tool/modules/nginx.py @@ -16,8 +16,9 @@ with open(os.path.join(nginx_template_dir, 'server.schema.json')) as f:  jsonschema.validate(server, schema) -non_template_files = ['ssl.conf', 'forbid_unknown_domain.conf'] +non_template_files = ['forbid_unknown_domain.conf'] +ssl_template = Template(os.path.join(nginx_template_dir, 'ssl.conf.template'))  root_template = Template(os.path.join(      nginx_template_dir, 'root.conf.template'))  static_file_template = Template(os.path.join( @@ -38,6 +39,9 @@ def nginx_config_gen(domain: str, dest: str) -> None:          dst = os.path.join(dest, filename)          shutil.copyfile(src, dst)      config = {"CRUPEST_DOMAIN": domain} +    # generate ssl.conf +    with open(os.path.join(dest, 'ssl.conf'), 'w') as f: +        f.write(ssl_template.generate(config))      # generate root.conf      with open(os.path.join(dest, f'{domain}.conf'), 'w') as f:          f.write(root_template.generate(config)) @@ -80,7 +84,7 @@ def certbot_command_gen(domain: str, action, test=False) -> str:  def nginx_config_dir_check(dir_path: str, domain: str) -> list: -    good_files = [*non_template_files, * +    good_files = [*non_template_files, "ssl.conf", *                    [f"{full_domain}.conf" for full_domain in list_domains(domain)]]      bad_files = []      for path in os.listdir(dir_path):  | 
