1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hubzilla_ynh.git synced 2024-09-03 19:26:21 +02:00

Ability to set the app public or not

This commit is contained in:
polytan02 2017-02-17 14:45:54 +00:00
parent 4525649377
commit 024a7b734a
4 changed files with 39 additions and 4 deletions

View file

@ -67,6 +67,15 @@
"choices": ["64M", "128M", "256M", "512M", "1024M"],
"default": "256M",
"optional": false
},
{
"name": "is_public",
"ask": {
"en": "Is it a public website ?",
"fr": "Est-ce un site publique ?"
},
"choices": ["Yes", "No"],
"default": "Yes"
}
]
}

View file

@ -17,6 +17,7 @@ path=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
email=$YNH_APP_ARG_EMAIL
upload=$YNH_APP_ARG_UPLOAD
is_public=$YNH_APP_ARG_IS_PUBLIC
# Source app helpers
source /usr/share/yunohost/helpers
@ -40,6 +41,7 @@ ynh_app_setting_set $app path $path
ynh_app_setting_set $app admin $admin
ynh_app_setting_set $app email $email
ynh_app_setting_set $app upload $upload
ynh_app_setting_set $app is_public $is_public
# Install dependencies
sudo apt-get update
@ -124,8 +126,15 @@ sudo chmod 644 $phpfpmconf
sed -i "s@YNH_WWW_PATH@$final_path@g" ../conf/poller-cron
sudo cp ../conf/poller-cron /etc/cron.d/$app
# Enable api for client and make app public
ynh_app_setting_set $app skipped_uris "/"
# Make app public if necessary
is_public=$(ynh_app_setting_get $app is_public)
if [ "$is_public" = "Yes" ];
then
ynh_app_setting_set $app skipped_uris "/"
else
ynh_app_setting_set $app protected_uris "/"
fi
# Reload services
sudo service php5-fpm restart || true

View file

@ -8,6 +8,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
path=$(ynh_app_setting_get $app path)
is_public=$(ynh_app_setting_get $app is_public)
admin=$(ynh_app_setting_get $app admin)
final_path=$(ynh_app_setting_get $app final_path)
db_user=$(ynh_app_setting_get $app db_user)
@ -44,6 +45,15 @@ sudo cp -a $backup_dir/php-fpm.conf /etc/php5/fpm/pool.d/$app.conf
# Backup cron job
sudo cp -a $backup_dir/cron.job /etc/cron.d/$app
# Make app public if necessary
is_public=$(ynh_app_setting_get $app is_public)
if [ "$is_public" = "Yes" ];
then
ynh_app_setting_set $app skipped_uris "/"
else
ynh_app_setting_set $app protected_uris "/"
fi
# And Reload services
sudo service php5-fpm restart
sudo service nginx reload

View file

@ -10,6 +10,7 @@ source /usr/share/yunohost/helpers
domain=$(ynh_app_setting_get $app domain)
path=$(ynh_app_setting_get $app path)
is_public=$(ynh_app_setting_get $app is_public)
admin=$(ynh_app_setting_get $app admin)
final_path=$(ynh_app_setting_get $app final_path)
db_pwd=$(ynh_app_setting_get $app db_pwd)
@ -74,8 +75,14 @@ sudo chown root: $phpfpmconf
sed -i "s@YNH_WWW_PATH@$final_path@g" ../conf/poller-cron
sudo cp ../conf/poller-cron /etc/cron.d/$app
# Enable api for client and make app public
ynh_app_setting_set $app skipped_uris "/"
# Make app public if necessary
is_public=$(ynh_app_setting_get $app is_public)
if [ "$is_public" = "Yes" ];
then
ynh_app_setting_set $app skipped_uris "/"
else
ynh_app_setting_set $app protected_uris "/"
fi
# Reload services
sudo service php5-fpm restart || true