mirror of
https://github.com/YunoHost-Apps/synapse-admin_ynh.git
synced 2024-09-03 20:26:34 +02:00
26 lines
978 B
Bash
26 lines
978 B
Bash
#!/bin/bash
|
|
|
|
_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" ]]
|
|
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
|
|
fi
|
|
|
|
# In case the domain changed for some reason
|
|
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
|
|
|
|
ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf"
|
|
}
|