mirror of
https://github.com/YunoHost-Apps/synapse_ynh.git
synced 2024-09-03 20:26:38 +02:00
Get actual IP for coturn in restore script
This commit is contained in:
parent
ef23ab70d7
commit
599f28a600
2 changed files with 47 additions and 7 deletions
|
@ -47,13 +47,6 @@ ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
|||
|
||||
ynh_backup "/etc/matrix-$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP COTURN CONFIG
|
||||
#=================================================
|
||||
|
||||
ynh_backup "/etc/turnserver.conf"
|
||||
ynh_backup "/etc/default/coturn"
|
||||
|
||||
#=================================================
|
||||
# BACKUP SYSTEMD
|
||||
#=================================================
|
||||
|
|
|
@ -70,6 +70,53 @@ ynh_system_user_create $synapse_user /var/lib/matrix-$app
|
|||
adduser $synapse_user ssl-cert
|
||||
adduser turnserver ssl-cert
|
||||
|
||||
#=================================================
|
||||
# RECONFIGURE THE TURNSERVER
|
||||
#=================================================
|
||||
|
||||
# To be sure that a the restoration the IP adress in coturn config is same than the real adress we remake the coturn config
|
||||
|
||||
# Retrive specific settings
|
||||
turnserver_tls_port=$(ynh_app_setting_get $app turnserver_tls_port)
|
||||
turnserver_alt_tls_port=$(ynh_app_setting_get $app turnserver_alt_tls_port)
|
||||
turnserver_pwd=$(ynh_app_setting_get $app turnserver_pwd)
|
||||
cli_port=$(ynh_app_setting_get $app cli_port)
|
||||
|
||||
# WARRNING : theses command are used in INSTALL, UPGRADE
|
||||
# For any update do it in all files
|
||||
|
||||
coturn_config_path="/etc/matrix-$app/coturn.conf"
|
||||
|
||||
cp ../settings/conf/turnserver.conf "$coturn_config_path"
|
||||
|
||||
ynh_replace_string __APP__ $app "$coturn_config_path"
|
||||
ynh_replace_string __TURNPWD__ $turnserver_pwd "$coturn_config_path"
|
||||
ynh_replace_string __DOMAIN__ $domain "$coturn_config_path"
|
||||
ynh_replace_string __TLS_PORT__ $turnserver_tls_port "$coturn_config_path"
|
||||
ynh_replace_string __TLS_ALT_PORT__ $turnserver_alt_tls_port "$coturn_config_path"
|
||||
ynh_replace_string __CLI_PORT__ $cli_port "$coturn_config_path"
|
||||
|
||||
# Get public IP and set as external IP for coturn
|
||||
# note : '|| true' is used to ignore the errors if we can't get the public ipv4 or ipv6
|
||||
public_ip4="$(curl ip.yunohost.org)" || true
|
||||
public_ip6="$(curl ipv6.yunohost.org)" || true
|
||||
|
||||
if [[ -n "$public_ip4" ]] && ynh_validate_ip4 "$public_ip4"
|
||||
then
|
||||
ynh_replace_string '__IPV4__' "$public_ip4" "$coturn_config_path"
|
||||
else
|
||||
ynh_replace_string '__IPV4__,' "" "$coturn_config_path"
|
||||
fi
|
||||
|
||||
if [[ -n "$public_ip6" ]] && ynh_valide_ip6 "$public_ip6"
|
||||
then
|
||||
ynh_replace_string '__IPV6__' "$public_ip6" "$coturn_config_path"
|
||||
else
|
||||
ynh_replace_string ',__IPV6__' "" "$coturn_config_path"
|
||||
fi
|
||||
|
||||
ynh_store_file_checksum "$coturn_config_path"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue