1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cachet_ynh.git synced 2024-09-03 18:16:03 +02:00
cachet_ynh/scripts/change_url
Éric Gaspar bb6a88d490
Version 2 (#32) (#33)
* v2

* Auto-update README

* v2

* fix

* Auto-update README

---------

Co-authored-by: yunohost-bot <yunohost@yunohost.org>
2023-06-21 09:27:43 +02:00

45 lines
1.8 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
ynh_change_url_nginx_config
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1
ynh_backup_if_checksum_is_different --file="$install_dir/.env"
ynh_backup_if_checksum_is_different --file="$install_dir/bootstrap/cachet/production.php"
# Replace domain in Cachet configuration files
ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="$install_dir/.env"
ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="$install_dir/bootstrap/cachet/production.php"
ynh_store_file_checksum --file="$install_dir/.env"
ynh_store_file_checksum --file="$install_dir/bootstrap/cachet/production.php"
# Replace domain in Cachet database settings
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" <<< "UPDATE settings SET value = 'https://$new_domain' WHERE name = 'app_domain'"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last