diff --git a/config_panel.toml b/config_panel.toml index 375b895..48c03ed 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -25,15 +25,13 @@ name = "My Webapp configuration" ask = "Activate the custom error file use" type = "boolean" default = false - # default = "/404.html" help = "you enable this, you can create a custom `404.html` file at the root of your app to act as the custom 404 error page" - [main.code_error.path_folder] - ask = "Specifie folder where your error file are sto" - type = "string" - default = "/" - help = "You can set where your error file are store in your www folder." - + # [main.code_error.path_folder] + # ask = "Specifie folder where your error file are sto" + # type = "string" + # default = "/" + # help = "You can set where your error file are store in your www folder." [main.php_fpm_config] name = "PHP-FPM configuration" diff --git a/scripts/install b/scripts/install index a976713..d671e86 100644 --- a/scripts/install +++ b/scripts/install @@ -63,6 +63,12 @@ then YNH_PHP_VERSION="$phpversion" fi +if [ ! $custom_error_file ] +then + ynh_add_config --template="nginx-code-error.conf" --destination="$nginx_extra_conf_dir/error-code.conf" + CUSTOM_ERROR_FILE="$custom_error_file" +fi + # Create a dedicated NGINX config ynh_add_nginx_config ynh_add_config --template="example-custom-nginx-config.conf" --destination="$nginx_extra_conf_dir/sample.conf" diff --git a/scripts/upgrade b/scripts/upgrade index 99ee670..a9beb78 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -56,9 +56,9 @@ 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 [ -n "$(ynh_app_setting_get --app=$app --key=codeerror)" ]; then - codeerror=$(ynh_app_setting_get --app=$app --key=codeerror) +# If custom_error_files doesn't exist, create it. We assume it is the default system one. +if [ -n "$(ynh_app_setting_get --app=$app --key=custom_error_file)" ]; then + custom_error_file=$(ynh_app_setting_get --app=$app --key=custom_error_file) fi # Delete old user @@ -96,10 +96,9 @@ then fi # Add the config error code -if [ -n "$(ynh_app_setting_get --app=$app --key=codeerror)" ]; +if [ ! $custom_error_file ] then - echo add the error config - ynh_add_config --template="nginx-code-error.conf" --destination="$nginx_extra_conf_dir/error.conf" + ynh_add_config --template="nginx-code-error.conf" --destination="$nginx_extra_conf_dir/error-code.conf" fi # Create a dedicated NGINX config