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)
|
2024-04-16 17:56:48 +02:00
|
|
|
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
|
2024-04-16 17:56:48 +02:00
|
|
|
|
|
|
|
# In case the domain changed for some reason
|
2024-04-16 19:12:24 +02:00
|
|
|
old_endpoint_confs_for_this_app="$(ls /etc/nginx/conf.d/*.d/$app.endpoint.conf 2>/dev/null | grep -v "$synapse_domain.d" || true)"
|
2024-04-16 17:56:48 +02:00
|
|
|
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"
|
|
|
|
}
|