reverseproxy_ynh/scripts/restore

52 lines
1.6 KiB
Text
Raw Normal View History

2016-06-20 23:43:51 +02:00
#!/bin/bash
2018-05-26 10:27:01 +02:00
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2016-06-20 23:43:51 +02:00
2023-01-08 14:33:31 +01:00
source ../settings/scripts/_common.sh
2018-05-26 10:27:01 +02:00
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
2016-06-20 23:43:51 +02:00
# Retrieve arguments
2019-05-15 18:42:44 +02:00
app=$YNH_APP_INSTANCE_NAME
2021-08-22 08:58:18 +02:00
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
2023-01-08 14:33:31 +01:00
proxy_path=$(ynh_app_setting_get --app=$app --key=proxy_path)
assets_path=$(ynh_app_setting_get --app=$app --key=assets_path)
2016-06-20 23:43:51 +02:00
#=================================================
# REVERSEPROXY_YNH
#=================================================
2023-01-08 14:33:31 +01:00
# Revalidate destination path
rp_validate_proxy_path "$proxy_path"
2016-06-20 23:43:51 +02:00
# Check configuration files
NGINX_CONF="/etc/nginx/conf.d/${domain}.d/${app}.conf"
[[ -f $NGINX_CONF ]] && ynh_die "The NGINX configuration already exists at '${NGINX_CONF}'. You should safely delete it before restoring this app."
2016-06-20 23:43:51 +02:00
# Restore configuration files
2019-05-15 18:42:44 +02:00
ynh_restore_file "$NGINX_CONF"
2016-06-20 23:43:51 +02:00
2023-01-08 14:33:31 +01:00
# Reload nginx
rp_reload_web
2021-01-23 15:21:17 +01:00
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last