my_idlers_ynh/scripts/change_url

46 lines
1.7 KiB
Text
Raw Normal View History

2017-06-02 18:46:29 +02:00
#!/bin/bash
2024-01-28 23:40:59 +01:00
## this script is only run if actual change to domain/path is detected, if you're here either $domain or $path changed
## new location is available via $domain and $path (or $new_domain and $new_path variables if you want to be explicit)
## old values are available via, you guessed it, $old_domain and $old_path
2017-06-02 18:46:29 +02:00
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2017-06-05 13:06:12 +02:00
source _common.sh
2017-06-02 18:46:29 +02:00
source /usr/share/yunohost/helpers
2019-05-02 20:44:22 +02:00
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
2025-03-02 21:27:39 +01:00
## My Idlers runs as a Laravel app on nginx; keep that running.
2019-05-02 20:44:22 +02:00
2017-06-02 18:46:29 +02:00
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
2024-06-20 23:49:43 +02:00
ynh_script_progression "Updating NGINX web server configuration..."
2017-06-02 18:46:29 +02:00
2024-01-28 23:40:59 +01:00
# this will most likely adjust NGINX config correctly
2024-06-20 23:49:43 +02:00
ynh_config_change_url_nginx
2017-06-02 18:46:29 +02:00
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
2025-03-02 21:27:39 +01:00
## Only the app_url in .env needs to change
sed -i -e 's/$old_domain/new_domain/g' $install_dir/.env
sed -i -e 's/$old_path/new_path/g' $install_dir/.env
## perhaps a better option, ynh_replace + ynh_store_file_checksum
# ynh_replace --match=$old_domain --replace="$new_domain --file="$install_dir/.env"
# ynh_replace --match=$old_path --replace="$new_path --file="$install_dir/.env"
ynh_store_file_checksum "$install_dir/.env"
2019-05-02 20:44:22 +02:00
2019-02-10 15:02:38 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2024-06-20 23:49:43 +02:00
ynh_script_progression "Change of URL completed for $app"