1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/peertube_ynh.git synced 2024-09-03 19:56:29 +02:00
This commit is contained in:
yalh76 2019-10-24 02:39:32 +02:00
parent 023b4224b6
commit 591cf83b70
6 changed files with 48 additions and 4 deletions

View file

@ -0,0 +1,31 @@
#!/bin/bash
force=${2:-0} # 0/1 --force argument
dryrun=${3:-0} # 0/1 --dry-run argument
pending_conf=$4 # Path of the pending conf file
do_pre_regen() {
# Put your code here for pre regen conf.
sed --in-place "s/X-Frame-Options : SAMEORIGIN/X-Frame-Options : ALLOWALL/g" "${pending_conf}/../nginx/etc/nginx/conf.d/__DOMAIN__.conf"
}
do_post_regen() {
# Put your code here for post regen conf.
# Be careful, this part will be executed only if the configuration has been modified.
regen_conf_files=$1
}
case "$1" in
pre)
do_pre_regen
;;
post)
do_post_regen
;;
*)
echo "Hook called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0

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

@ -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

@ -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