1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/synapse-admin_ynh.git synced 2024-09-03 20:26:34 +02:00
synapse-admin_ynh/scripts/_common.sh

27 lines
978 B
Bash
Raw Normal View History

2021-05-10 15:15:42 +02:00
#!/bin/bash
2024-04-16 18:19:27 +02:00
_add_synapse_endpoint_nginx_config() {
synapse_domain=$(ynh_app_setting_get --app="$synapse_app" --key=domain)
synapse_port=$(ynh_app_setting_get --app="$synapse_app" --key=port_synapse)
if [[ -z "$synapse_port" ]]
2024-04-16 18:19:27 +02:00
then
# The setting was synapse_port in older versions of the app
synapse_port=$(ynh_app_setting_get --app="$synapse_app" --key=synapse_port)
if [[ -z "$synapse_port" ]]
then
ynh_die --message="Unable to find synapse port ?!"
fi
2024-01-08 12:11:02 +01:00
fi
# In case the domain changed for some reason
2024-04-16 18:19:27 +02:00
old_endpoint_confs_for_this_app="$(ls /etc/nginx/conf.d/!($synapse_domain).d/$app.endpoint.conf 2>/dev/null)"
for FILE in $old_endpoint_confs_for_this_app
do
ynh_delete_file_checksum --file="$FILE"
ynh_secure_remove --file="$FILE"
done
2024-01-08 12:11:02 +01:00
ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf"
}