1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/peertube_ynh.git synced 2024-09-03 19:56:29 +02:00

Merge pull request #128 from YunoHost-Apps/fix_nginx

add hook
This commit is contained in:
yalh76 2019-11-22 02:10:48 +01:00 committed by GitHub
commit f418327e5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 6 deletions

View file

@ -0,0 +1,7 @@
#!/bin/bash
pending_conf=$4
if [[ "$1" == "pre" ]]
then
sed --in-place "s/X-Frame-Options : SAMEORIGIN/X-Frame-Options : ALLOWALL/g" "${pending_conf}/../nginx/etc/nginx/conf.d/__DOMAIN__.conf"
fi

View file

@ -63,6 +63,13 @@ ynh_psql_dump_db --database="$db_name" > db.sql
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP HOOK
#=================================================
ynh_print_info --message="Backing up hook configuration..."
ynh_backup --src_path="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app"
#=================================================
# BACKUP LOGROTATE
#=================================================

View file

@ -125,7 +125,7 @@ ynh_add_nginx_config
ynh_print_info --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# SPECIFIC SETUP
@ -162,7 +162,9 @@ cp ../conf/local-production.json "$final_path/config/local-production.json"
# FIX NGINX DOMAIN CONFIGURATION
#=================================================
ynh_replace_string --match_string="X-Frame-Options : SAMEORIGIN" --replace_string="X-Frame-Options : ALLOWALL" --target_file="/etc/nginx/conf.d/$domain.conf"
cp -R ../conf/nginx_regen_conf.hook /usr/share/yunohost/hooks/conf_regen/15-nginx_$app
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app"
yunohost tools regen-conf nginx
#=================================================
# STORE THE CHECKSUM OF THE CONFIG FILE

View file

@ -102,7 +102,8 @@ fi
# RESTORE ORIGINAL NGINX DOMAIN CONFIGURATION
#=================================================
ynh_replace_string --match_string="X-Frame-Options : ALLOWALL" --replace_string="X-Frame-Options : SAMEORIGIN" --target_file="/etc/nginx/conf.d/$domain.conf"
ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app"
yunohost tools regen-conf nginx
#=================================================
# GENERIC FINALIZATION

View file

@ -66,7 +66,7 @@ ynh_restore_file --origin_path="$final_path"
ynh_print_info --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# RESTORE USER RIGHTS
@ -105,7 +105,8 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st
# FIX NGINX DOMAIN CONFIGURATION
#=================================================
ynh_replace_string --match_string="X-Frame-Options : SAMEORIGIN" --replace_string="X-Frame-Options : ALLOWALL" --target_file="/etc/nginx/conf.d/$domain.conf"
ynh_restore_file --origin_path="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app"
yunohost tools regen-conf nginx
#=================================================
# RESTORE THE POSTGRESQL DATABASE

View file

@ -188,7 +188,9 @@ ynh_store_file_checksum --file="$final_path/config/production.yaml"
# FIX NGINX DOMAIN CONFIGURATION
#=================================================
ynh_replace_string --match_string="X-Frame-Options : SAMEORIGIN" --replace_string="X-Frame-Options : ALLOWALL" --target_file="/etc/nginx/conf.d/$domain.conf"
cp -R ../conf/nginx_regen_conf.hook /usr/share/yunohost/hooks/conf_regen/15-nginx_$app
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app"
yunohost tools regen-conf nginx
#=================================================
# BUILD YARN DEPENDENCIES