mirror of
https://github.com/YunoHost-Apps/redirect_ynh.git
synced 2024-09-03 20:16:10 +02:00
37 lines
1.1 KiB
Bash
37 lines
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# ENSURE DOWNWARD COMPATIBILITY
|
|
#=================================================
|
|
|
|
if [[ "${redirect_type:-}" == *"proxy"* ]]; then
|
|
redirect_type="reverseproxy"
|
|
else
|
|
redirect_type="redirect"
|
|
fi
|
|
ynh_app_setting_set $app 'redirect_type' $redirect_type
|
|
|
|
if [[ -z "${target:-}" ]] && [[ -n "${redirect_path:-}" ]]; then
|
|
target="$redirect_path"
|
|
ynh_app_setting_delete --app=$app --key=redirect_path
|
|
ynh_app_setting_set --app=$app --key=target --value="$redirect_path"
|
|
fi
|
|
|
|
# When testing on the CI, we need a service to test the reverse-proxying
|
|
if [[ ${PACKAGE_CHECK_EXEC} == "1" ]] && [[ "$redirect_type" == "reverseproxy" ]]
|
|
then
|
|
_add_dummy_service
|
|
fi
|
|
|
|
#=================================================
|
|
# CONFIGURE NGINX
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
|
|
|
mv ../conf/{nginx-$redirect_type.conf,nginx.conf}
|
|
ynh_add_nginx_config
|
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|