1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pixelfed_ynh.git synced 2024-09-03 20:06:04 +02:00
pixelfed_ynh/scripts/change_url
lapineige 212ce48b1c
Testing : fix .env default config (#220)
* v2

* v2

* Create tests.toml

* Auto-update README

* fix

* Update _common.sh

* Update install

* Update manifest.toml

* Update manifest.toml

* cleaning

* Auto-update README

* Auto-update README

* Add post edits (from dev branch)

Using lastest commit as most of the previous ones fix edits stuff + bugs
5cfe8cd56a

* bump version

* Auto-update README

* cleaning

* Update manifest.toml

* Auto-update README

* Update ADMIN.md

* Update change_url

* php8.2

* php8.2

* add ressources needed

* php8.2

* update PHP

* post edit formatting fixes

4479055e1e

* v0.11.8

* v0.11.8

* Auto-update README

* Master -> ynh V2 (v0.11.8)

* Auto-update README

* Update .env

* Fix .env + improvements

https://github.com/YunoHost-Apps/pixelfed_ynh/pull/219#issuecomment-1568049256

* Update manifest.toml

* Auto-update README

---------

Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: ericgaspar <junk.eg@free.fr>
2023-06-10 11:23:39 +02:00

71 lines
2.9 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# STOP SUPERVISOR SERVICE
#=================================================
ynh_script_progression --message="Stopping a supervisor service..." --weight=1
ynh_supervisor_action --service_name="${app}-horizon" --action="stop" --log_path="/var/log/$app/${app}-horizon.log"
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
ynh_change_url_nginx_config
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# UPDATE CONFIG FILE
#=================================================
ynh_script_progression --message="Updating config file..." --weight=1
config="$install_dir/.env"
ynh_backup_if_checksum_is_different --file="$config"
ynh_replace_string --match_string="APP_URL=.*" --replace_string="APP_URL=https://$new_domain" --target_file="$config"
ynh_replace_string --match_string="ADMIN_DOMAIN=.*" --replace_string="ADMIN_DOMAIN=\"$new_domain\"" --target_file="$config"
ynh_replace_string --match_string="APP_DOMAIN=.*" --replace_string="APP_DOMAIN=\"$new_domain\"" --target_file="$config"
ynh_replace_string --match_string="MAIL_FROM_ADDRESS=.*" --replace_string="MAIL_FROM_ADDRESS=\"pixelfed@$new_domain\"" --target_file="$config"
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$config"
#=================================================
# APPLY CHANGES
#=================================================
ynh_script_progression --message="Applying changes..." --weight=1
pushd "$install_dir"
php$phpversion artisan config:clear
php$phpversion artisan config:cache
php$phpversion artisan route:clear
php$phpversion artisan route:cache
php$phpversion artisan horizon:purge
popd
#=================================================
# GENERIC FINALISATION
#=================================================
# START SUPERVISOR SERVICE
#=================================================
ynh_script_progression --message="Starting a supervisor service..." --weight=1
ynh_supervisor_action --service_name="${app}-horizon" --action="start" --log_path="systemd" --line_match="success: ${app}-horizon"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last