From 2fbe760a038a1e65f574d30ffb293c7499229235 Mon Sep 17 00:00:00 2001 From: scith Date: Tue, 2 May 2017 13:39:03 +0200 Subject: [PATCH] Open /api and fix restore - Open the /api path so that mobile apps can connect using the API key - Fix restore --- scripts/backup | 2 +- scripts/install | 6 +++++- scripts/remove | 2 +- scripts/restore | 11 ++++++----- scripts/upgrade | 6 +++++- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/scripts/backup b/scripts/backup index 0c20a6d..740ef1f 100644 --- a/scripts/backup +++ b/scripts/backup @@ -3,7 +3,7 @@ app=$YNH_APP_INSTANCE_NAME # Source app helpers -. /usr/share/yunohost/helpers + source /usr/share/yunohost/helpers # Common variable declaration app_install_dir="/opt/yunohost/$app" diff --git a/scripts/install b/scripts/install index c38eb56..0ba28fe 100644 --- a/scripts/install +++ b/scripts/install @@ -6,7 +6,7 @@ # Source app helpers -. /usr/share/yunohost/helpers + source /usr/share/yunohost/helpers # Retrieve arguments domain=$YNH_APP_ARG_DOMAIN @@ -152,5 +152,9 @@ sed -i "s@__PORT__@$port@g" ../conf/nginx.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf +# Open the /api path so that external applications can connect + ynh_app_setting_set "$app" unprotected_uris "/api" + # Reload Nginx and regenerate SSOwat conf sudo service nginx reload + sudo yunohost app ssowatconf diff --git a/scripts/remove b/scripts/remove index 88b5d46..9692369 100644 --- a/scripts/remove +++ b/scripts/remove @@ -4,7 +4,7 @@ app=$YNH_APP_INSTANCE_NAME # Source app helpers -. /usr/share/yunohost/helpers + source /usr/share/yunohost/helpers # Common variable declaration app_install_dir="/opt/yunohost/$app" diff --git a/scripts/restore b/scripts/restore index d8debe6..6181e63 100644 --- a/scripts/restore +++ b/scripts/restore @@ -4,7 +4,7 @@ app=$YNH_APP_INSTANCE_NAME # Source app helpers -. /usr/share/yunohost/helpers + source /usr/share/yunohost/helpers # Common variable declaration app_install_dir="/opt/yunohost/$app" @@ -35,9 +35,6 @@ "The Systemd configuration already exists at '${systemd_conf}'. You should safely delete it before restoring this app." -# Kill app if running - sudo systemctl stop $app - # Restore sources sudo mkdir -p $app_install_dir sudo cp -a ./sources/. $app_install_dir @@ -90,5 +87,9 @@ # Restore Nginx conf sudo cp -a ./nginx.conf "$nginx_conf" -# Reload Nginx +# Open the /api path so that external applications can connect + ynh_app_setting_set "$app" unprotected_uris "/api" + +# Reload Nginx and regenerate SSOwat conf sudo service nginx reload + sudo yunohost app ssowatconf diff --git a/scripts/upgrade b/scripts/upgrade index 167851e..d7ac2dd 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,7 +19,7 @@ trap EXIT_PROPERLY ERR # Source app helpers -. /usr/share/yunohost/helpers + source /usr/share/yunohost/helpers # Retrieve arguments domain=$(ynh_app_setting_get "$app" domain) @@ -98,5 +98,9 @@ sed -i "s@__PORT__@$port@g" ../conf/nginx.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf +# Open the /api path so that external applications can connect + ynh_app_setting_set "$app" unprotected_uris "/api" + # Reload Nginx and regenerate SSOwat conf sudo service nginx reload + sudo yunohost app ssowatconf