diff --git a/manifest.json b/manifest.json index 0cb0235..6d495d8 100644 --- a/manifest.json +++ b/manifest.json @@ -30,6 +30,15 @@ }, "example": "/example", "default": "/ihatemoney" + }, + { + "name": "is_public", + "ask": { + "en": "Is it a public website ? (even if service is public, each project is protected by a password)", + "fr": "Le service est-il public ? (même dans ce cas, chaque projet est protégé par un mot de passe)" + }, + "choices": ["Yes", "No"], + "default": "Yes" } ] } diff --git a/scripts/install b/scripts/install index 43a5958..f0ca760 100755 --- a/scripts/install +++ b/scripts/install @@ -5,6 +5,8 @@ set -e # Retrieve arguments domain=$1 path=$2 +is_public=$3 +app=ihatemoney # Constant arguments db_user=ihatemoney @@ -19,8 +21,9 @@ fi # Remove trailing "/" for next commands path=${path%/} -# Configure domain -sudo yunohost app setting ihatemoney domain -v $domain +# Save app settings +sudo yunohost app setting $app domain -v $domain +sudo yunohost app setting $app is_public -v "$is_public" # Install debian packages dependencies sudo apt-get install -y -qq python-dev python-virtualenv supervisor @@ -55,7 +58,7 @@ sudo yunohost service add supervisor # Configure database db_pwd=`sudo yunohost app initdb $db_user` -sudo yunohost app setting ihatemoney mysqlpwd -v $db_pwd +sudo yunohost app setting $app mysqlpwd -v $db_pwd # Configure ihatemoney sed -i "s@MY_SECRET_KEY@$secret_key@" ../conf/settings.py @@ -67,6 +70,13 @@ sudo install -o ihatemoney -g ihatemoney -m 640 \ # The settings have to be stored here (on python path) sudo ln -s /etc/ihatemoney/settings.py /opt/yunohost/ihatemoney/src/budget/settings.py + +# If app is public, add url to SSOWat conf as skipped_uris +if [ "$is_public" = "Yes" ]; +then + sudo yunohost app setting $app unprotected_uris -v "/" +fi + # Configure Nginx and reload sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf sudo install -o root -g root -m644 \