mirror of
https://github.com/YunoHost-Apps/reverseproxy_ynh.git
synced 2024-09-03 20:16:23 +02:00
Use ynh_script_progression in _common.sh script
This commit is contained in:
parent
fea7706579
commit
bc55b0d0ff
6 changed files with 11 additions and 15 deletions
|
@ -28,7 +28,7 @@ rp_validate_proxy_path() {
|
|||
# Make reverse proxy public if $1 is 1
|
||||
# Yunohost boolean params are 1 if true
|
||||
rp_make_permissions() {
|
||||
#ynh_script_progression --message="Configuring permissions..." --weight=2
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=2
|
||||
|
||||
if [ $1 = 1 ]; then
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
|
@ -37,7 +37,7 @@ rp_make_permissions() {
|
|||
|
||||
# (re)generate nginx config
|
||||
rp_make_webconfig() {
|
||||
#ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||
|
||||
# Nginx configuration
|
||||
ynh_replace_string "YNH_LOCATION" "$path_url" ../conf/nginx.conf
|
||||
|
@ -48,6 +48,6 @@ rp_make_webconfig() {
|
|||
}
|
||||
|
||||
rp_reload_web() {
|
||||
#ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
}
|
||||
|
|
|
@ -29,9 +29,8 @@ new_path=$YNH_APP_NEW_PATH
|
|||
# Path availability is already checked for
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE NGINX
|
||||
# REVERSEPROXY_YNH
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||
|
||||
# Nginx configuration
|
||||
ynh_replace_string "$old_path {" "$new_path {" /etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
@ -42,7 +41,6 @@ ynh_replace_string "302 ${old_path}/" "302 ${new_path}/" /etc/nginx/conf.d/$old_
|
|||
[[ "$old_domain" != "$new_domain" ]] && mv /etc/nginx/conf.d/$old_domain.d/$app.conf /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||
|
||||
# Reload nginx
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
rp_reload_web
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -30,7 +30,7 @@ assets_path=$YNH_APP_ARG_ASSETS_PATH
|
|||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
|
||||
#=================================================
|
||||
# REVERSE PROXY LOGIC
|
||||
# REVERSEPROXY_YNH
|
||||
#=================================================
|
||||
|
||||
# Check domain/path availability
|
||||
|
@ -44,15 +44,12 @@ ynh_app_setting_set --app=$app --key=proxy_path --value=$proxy_path
|
|||
ynh_app_setting_set --app=$app --key=assets_path --value=$assets_path
|
||||
|
||||
# Configure nginx
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||
rp_make_webconfig
|
||||
|
||||
# Make app public if necessary
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=2
|
||||
rp_make_permissions $is_public
|
||||
|
||||
# Reload nginx
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
rp_reload_web
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -19,14 +19,13 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
# REVERSEPROXY_YNH
|
||||
#=================================================
|
||||
|
||||
# Remove configuration files
|
||||
ynh_secure_remove /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
|
||||
# Reload nginx
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
rp_reload_web
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -27,6 +27,10 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|||
proxy_path=$(ynh_app_setting_get --app=$app --key=proxy_path)
|
||||
assets_path=$(ynh_app_setting_get --app=$app --key=assets_path)
|
||||
|
||||
#=================================================
|
||||
# REVERSEPROXY_YNH
|
||||
#=================================================
|
||||
|
||||
# Revalidate destination path
|
||||
rp_validate_proxy_path "$proxy_path"
|
||||
|
||||
|
|
|
@ -35,18 +35,16 @@ ynh_clean_setup () {
|
|||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# REVERSE PROXY LOGIC
|
||||
# REVERSEPROXY_YNH
|
||||
#=================================================
|
||||
|
||||
# Validate proxy destination
|
||||
rp_validate_proxy_path "$proxy_path"
|
||||
|
||||
# Configure nginx
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||
rp_make_webconfig
|
||||
|
||||
# Reload nginx
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
rp_reload_web
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue