mirror of
https://github.com/YunoHost-Apps/conduit_ynh.git
synced 2024-09-03 18:16:30 +02:00
Implement .well-known location
This commit is contained in:
parent
f65ea2e2de
commit
9cdbdde621
6 changed files with 30 additions and 2 deletions
5
conf/server_name.conf
Normal file
5
conf/server_name.conf
Normal file
|
@ -0,0 +1,5 @@
|
|||
location /.well-known/matrix/server {
|
||||
return 200 '{"m.server": "__DOMAIN__:443"}';
|
||||
add_header Content-Type application/json;
|
||||
add_header Access-Control-Allow-Origin '*';
|
||||
}
|
|
@ -27,6 +27,11 @@ ynh_backup --src_path="$install_dir"
|
|||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
if yunohost --output-as plain domain list | grep -q "^$server_name$"
|
||||
then
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP SYSTEMD
|
||||
#=================================================
|
||||
|
|
|
@ -30,6 +30,12 @@ ynh_script_progression --message="Adding system configurations related to $app..
|
|||
# Create a dedicated NGINX config using the conf/nginx.conf template
|
||||
ynh_add_nginx_config
|
||||
|
||||
# Create .well-known redirection for access by federation
|
||||
if yunohost --output-as plain domain list | grep -q "^$server_name$"
|
||||
then
|
||||
ynh_add_config --template="server_name.conf" --destination="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf"
|
||||
fi
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
|
|
|
@ -29,6 +29,9 @@ ynh_remove_systemd_config
|
|||
|
||||
ynh_remove_nginx_config
|
||||
|
||||
# Remove the well-known location
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -22,12 +22,15 @@ chown -R $app:root "$install_dir"
|
|||
#=================================================
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
if yunohost --output-as plain domain list | grep -q "^$server_name$"
|
||||
then
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf"
|
||||
fi
|
||||
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
systemctl enable $app.service --quiet
|
||||
|
||||
|
|
|
@ -42,6 +42,12 @@ ynh_script_progression --message="Upgrading system configurations related to $ap
|
|||
|
||||
ynh_add_nginx_config
|
||||
|
||||
# Create .well-known redirection for access by federation
|
||||
if yunohost --output-as plain domain list | grep -q "^$server_name$"
|
||||
then
|
||||
ynh_add_config --template="server_name.conf" --destination="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf"
|
||||
fi
|
||||
|
||||
ynh_add_systemd_config
|
||||
|
||||
yunohost service add $app --description="Chat server powered by Matrix" --log="/var/log/$app/$app.log"
|
||||
|
|
Loading…
Add table
Reference in a new issue