From b863da7cff82ffb3f4aaa2636c50bc055497ba0b Mon Sep 17 00:00:00 2001 From: --help Date: Sun, 13 Aug 2023 10:47:43 +0200 Subject: [PATCH] Update upgrade to set the code error --- conf/nginx-code-error.conf | 5 +++++ manifest.toml | 2 +- scripts/upgrade | 10 ++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 conf/nginx-code-error.conf diff --git a/conf/nginx-code-error.conf b/conf/nginx-code-error.conf new file mode 100644 index 0000000..dba1050 --- /dev/null +++ b/conf/nginx-code-error.conf @@ -0,0 +1,5 @@ +# Build error access +error_page 404 /error/404.html; +location = __PATH__/error/404.html { + internal; +} \ No newline at end of file diff --git a/manifest.toml b/manifest.toml index 32879ee..10be47a 100644 --- a/manifest.toml +++ b/manifest.toml @@ -58,7 +58,7 @@ ram.runtime = "50M" type = "boolean" default = false - [install.errorfile] + [install.codeerror] ask.en = "Define a path about the 404 error page" ask.fr = "Definir un chemin pour la page d'erreur 404" type = "path" diff --git a/scripts/upgrade b/scripts/upgrade index bf15aaa..234636c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -56,6 +56,11 @@ if [ -z "$phpversion" ]; then ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion fi +# If $codeerror doesn't exist, create it. We assume it is the default system one. +if [ -z "$codeerror" ]; then + codeerror=$(ynh_app_setting_get --app=$app --key=codeerror) +fi + # Delete old user if [ -n "$(ynh_app_setting_get --app=$app --key=user)" ] then @@ -90,9 +95,10 @@ then YNH_PHP_VERSION="$phpversion" fi -if [ $errorfile ] +if [ $codeerror ] then - echo add the error config + echo add the error config + ynh_add_config --template="nginx-code-error.conf" --destination="$nginx_extra_conf_dir/error.conf" fi # Create a dedicated NGINX config