mirror of
https://github.com/YunoHost-Apps/redirect_ynh.git
synced 2024-09-03 20:16:10 +02:00
31 lines
958 B
Bash
31 lines
958 B
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=$app --key='redirect_type' --value=$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="$target"
|
|
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
|