From a1b9010d9e80227d37ec2a8a00ff7a07d6145167 Mon Sep 17 00:00:00 2001 From: bunkerity Date: Thu, 22 Jul 2021 14:47:37 +0200 Subject: [PATCH] pull v1.2.8 fixes when applicable --- gen/main.py | 13 ++++--------- settings.json | 18 +++++++++--------- ui/src/Config.py | 4 +++- ui/templates/services-new.html | 4 ++-- 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/gen/main.py b/gen/main.py index 6729740..17b241c 100755 --- a/gen/main.py +++ b/gen/main.py @@ -49,16 +49,11 @@ if __name__ == "__main__" : variables = utils.load_variables(args.variables) configurator.load_variables(variables) config = configurator.get_config() - #print(config) - # Remove old config - # TODO : remove unnecessary files after rendering -# for filename in os.listdir(args.output): -# file_path = os.path.join(args.output, filename) -# if os.path.isfile(file_path) or os.path.islink(file_path): -# os.unlink(file_path) -# elif os.path.isdir(file_path): -# shutil.rmtree(file_path) + # TODO : find a proper way to remove old sites + env_list = glob.glob(args.output + "/**/*.env", recursive=True) + for env in env_list : + os.remove(env) # Generate the files from templates and config templator = Templator(config, args.templates, args.output, args.target) diff --git a/settings.json b/settings.json index 1d91e45..770baf8 100644 --- a/settings.json +++ b/settings.json @@ -534,7 +534,7 @@ "env": "EMAIL_LETS_ENCRYPT", "id": "email-lets-encrypt", "label": "Email lets encrypt", - "regex": "^([a-z0-9\-\.]+@[a-z\-0-9\.]+|.{0})$", + "regex": "^([a-z0-9\\-\\.]+@[a-z\\-0-9\\.]+|.{0})$", "type": "text" }, { @@ -633,7 +633,7 @@ "env": "SELF_SIGNED_SSL_STATE", "id": "self-signed-ssl-state", "label": "State of the self-signed certificate", - "regex": "^[A-Za-z\\-]+$", + "regex": "^[A-Za-z\\- ]+$", "type": "text" }, { @@ -642,7 +642,7 @@ "env": "SELF_SIGNED_SSL_CITY", "id": "self-signed-ssl-city", "label": "City of the self-signed certificate", - "regex": "^[A-Za-z\\-]+$", + "regex": "^[A-Za-z\\- ]+$", "type": "text" }, { @@ -651,7 +651,7 @@ "env": "SELF_SIGNED_SSL_OU", "id": "self-signed-ssl-ou", "label": "Organizational Unit of the self-signed certificate", - "regex": "^[A-Za-z\\-]+$$", + "regex": "^[A-Za-z\\-]+$", "type": "text" }, { @@ -660,7 +660,7 @@ "env": "SELF_SIGNED_SSL_ORG", "id": "self-signed-ssl-org", "label": "Organization name of the self-signed certificate", - "regex": "^[A-Za-z\\- ]+$$", + "regex": "^[A-Za-z\\- ]+$", "type": "text" }, { @@ -974,7 +974,7 @@ "env": "REMOTE_PHP", "id": "remote-php", "label": "Remote php", - "regex": "^[a-z\-0-9_\.]*$", + "regex": "^[a-z\\-0-9_\\.]*$", "type": "text" }, { @@ -983,7 +983,7 @@ "env": "REMOTE_PHP_PATH", "id": "remote-php-path", "label": "Remote php path", - "regex": "^\/[a-zA-Z\-0-9_\.\/]*$", + "regex": "^\\/[a-zA-Z\\-0-9_\\.\\/]*$", "type": "text" }, { @@ -992,7 +992,7 @@ "env": "LOCAL_PHP", "id": "local-php", "label": "local php", - "regex": "^\/[a-zA-Z\-0-9_\.\/]*$", + "regex": "^\\/[a-zA-Z\\-0-9_\\.\\/]*$", "type": "text" }, { @@ -1001,7 +1001,7 @@ "env": "LOCAL_PHP_PATH", "id": "local-php-path", "label": "Local php path", - "regex": "^\/[a-zA-Z\-0-9_\.\/]*$", + "regex": "^\\/[a-zA-Z\\-0-9_\\.\\/]*$", "type": "text" } ] diff --git a/ui/src/Config.py b/ui/src/Config.py index 9f24cef..c065f09 100644 --- a/ui/src/Config.py +++ b/ui/src/Config.py @@ -58,7 +58,9 @@ class Config : for filename in glob.iglob("/etc/nginx/**/site.env") : env = self.__env_to_dict(filename) services.append(env) - services.append(self.__env_to_dict("/etc/nginx/site.env")) + no_multisite = self.__env_to_dict("/etc/nginx/site.env") + if len(no_multisite) > 0 : + services.append(no_multisite) return services def check_variables(self, variables) : diff --git a/ui/templates/services-new.html b/ui/templates/services-new.html index 3281462..7904d01 100644 --- a/ui/templates/services-new.html +++ b/ui/templates/services-new.html @@ -26,7 +26,7 @@ {% if param["type"] != "multiple" and param["context"] == "multisite" %}
{% set default = {"value": param["default"]} %} - {% if param["env"] in config["CONFIG"].get_config() %} + {% if param["env"] in config["CONFIG"].get_config() and param["env"] != "SERVER_NAME" %} {% set x = default.update({"value": config["CONFIG"].get_config()[param["env"]]}) %} {% endif %} {{ form_service_gen("form-new-" + param["id"], param["label"], param["type"], default["value"], param["env"])|safe }} @@ -58,4 +58,4 @@
- \ No newline at end of file +