2014-12-09 21:00:17 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2016-11-30 17:49:37 +01:00
|
|
|
source .fonctions # Charge les fonctions génériques habituellement utilisées dans le script
|
|
|
|
|
|
|
|
# Récupère les infos de l'application.
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
|
|
|
# Source app helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2014-12-09 21:00:17 +01:00
|
|
|
# Retrieve arguments
|
2016-11-30 17:55:46 +01:00
|
|
|
domain=$(ynh_app_setting_get $app domain)
|
|
|
|
path=$(ynh_app_setting_get $app path)
|
|
|
|
is_public=$(ynh_app_setting_get $app is_public)
|
|
|
|
port=$(ynh_app_setting_get $app port)
|
2015-02-27 14:41:04 +01:00
|
|
|
|
2014-12-09 21:00:17 +01:00
|
|
|
|
2016-11-30 17:49:37 +01:00
|
|
|
# Copie le fichier de config nginx
|
|
|
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
|
|
|
# Et modifie les variables dans le fichier de configuration nginx
|
|
|
|
sudo sed -i "s@__PATH__@$path@g" /etc/nginx/conf.d/$domain.d/$app.conf
|
|
|
|
sudo sed -i "s@__DOMAIN__@$domain@g" /etc/nginx/conf.d/$domain.d/$app.conf
|
|
|
|
sudo sed -i "s@__PORT__@$port@g" /etc/nginx/conf.d/$domain.d/$app.conf
|
2014-12-16 00:14:01 +01:00
|
|
|
|
|
|
|
if [ "$is_public" = "Yes" ];
|
|
|
|
then
|
2016-11-30 17:55:46 +01:00
|
|
|
ynh_app_setting_set $app unprotected_uris "/"
|
2014-12-16 00:14:01 +01:00
|
|
|
else
|
2016-11-30 17:55:46 +01:00
|
|
|
ynh_app_setting_delete $app unprotected_uris
|
2014-12-16 00:14:01 +01:00
|
|
|
fi
|
|
|
|
|
2014-12-12 22:15:20 +01:00
|
|
|
sudo service nginx reload
|
|
|
|
sudo yunohost app ssowatconf
|