test_apps/change_url_app_ynh/scripts/install
2021-06-04 18:51:04 +02:00

34 lines
745 B
Text

set -eux
# Source app helpers
source /usr/share/yunohost/helpers
app=$YNH_APP_INSTANCE_NAME
number=$YNH_APP_INSTANCE_NUMBER
# Retrieve arguments
domain=$YNH_APP_ARG_DOMAIN
path=$YNH_APP_ARG_PATH
# Check domain/path availability
ynh_webpath_register --app=$app --domain=$domain --path_url=$path
if [[ "$path" == "" ]]; then
sed -i "s@PATHTOCHANGE@/@g" ../conf/nginx.conf
else
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
fi
sed -i "s@FOLDER@$app/@g" ../conf/nginx.conf
cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
mkdir -p /var/www/$app
cp ../conf/index.html /var/www/$app
# Reload Nginx and regenerate SSOwat conf
service nginx reload
yunohost app setting $app unprotected_uris -v "/"
yunohost app ssowatconf