1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jenkins_ynh.git synced 2024-09-03 19:26:18 +02:00
jenkins_ynh/scripts/actions/public_private

77 lines
2.2 KiB
Text
Raw Normal View History

2018-09-30 11:50:17 +02:00
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2019-01-13 17:49:15 +01:00
source scripts/_common.sh
2018-09-30 11:50:17 +02:00
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
# Get is_public
is_public=${YNH_ACTION_IS_PUBLIC}
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
#=================================================
# CHECK IF ARGUMENTS ARE CORRECT
#=================================================
#=================================================
# CHECK IF AN ACTION HAS TO BE DONE
#=================================================
2019-05-28 00:28:01 +02:00
is_public_old=$(ynh_app_setting_get --app=$app --key=is_public)
2018-09-30 11:50:17 +02:00
if [ $is_public -eq $is_public_old ]
then
2019-05-28 00:28:01 +02:00
ynh_die --message="is_public is already set as $is_public." 0
2018-09-30 11:50:17 +02:00
fi
#=================================================
# SPECIFIC ACTION
#=================================================
# MOVE TO PUBLIC OR PRIVATE
#=================================================
2019-01-30 15:56:18 +01:00
if [ $is_public -eq 0 ]; then
public_private="private"
else
public_private="public"
fi
2021-04-10 20:50:48 +02:00
ynh_script_progression --message="Moving the application to $public_private..."
2018-09-30 11:50:17 +02:00
if [ $is_public -eq 0 ]
then
2019-05-28 00:28:01 +02:00
ynh_app_setting_delete --app=$app --key=unprotected_uris
2019-01-13 18:07:28 +01:00
# /path/github-webhook has to be accessible for github's webhooks
2019-05-28 00:28:01 +02:00
ynh_app_setting_set --app=$app --key=skipped_uris --value="/github-webhook"
2018-09-30 11:50:17 +02:00
else
2019-05-28 00:28:01 +02:00
ynh_app_setting_delete --app=$app --key=skipped_uris
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
2018-09-30 11:50:17 +02:00
fi
2019-01-30 15:56:18 +01:00
ynh_script_progression --message="Reconfigure SSOwat"
2018-09-30 11:50:17 +02:00
# Regen ssowat configuration
yunohost app ssowatconf
# Update the config of the app
2019-05-28 00:28:01 +02:00
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
2018-09-30 11:50:17 +02:00
#=================================================
# RELOAD NGINX
#=================================================
2019-01-30 15:56:18 +01:00
ynh_script_progression --message="Reload nginx"
2018-09-30 11:50:17 +02:00
2021-03-01 21:50:33 +01:00
ynh_systemd_action --service_name=nginx --action=reload
2019-01-30 15:56:18 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2021-04-10 20:50:48 +02:00
ynh_script_progression --message="Execution completed"