mirror of
https://github.com/YunoHost-Apps/mattermost_ynh.git
synced 2024-09-03 19:36:29 +02:00
scripts: modernize the publix/private switch
This allow package_check to properly test it.
This commit is contained in:
parent
3a6b0c752b
commit
aa7721322d
5 changed files with 25 additions and 10 deletions
|
@ -10,7 +10,7 @@
|
|||
; Checks
|
||||
pkg_linter=1
|
||||
setup_root=1
|
||||
setup_private=0
|
||||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
backup_restore=1
|
||||
|
|
|
@ -32,13 +32,13 @@
|
|||
"example": "domain.org"
|
||||
},
|
||||
{
|
||||
"name": "public_site",
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Can guest users access this chat?",
|
||||
"fr": "Les utilisateurs non-enregistrés peuvent-ils accéder à ce chat ?"
|
||||
},
|
||||
"choices": ["Yes", "No"],
|
||||
"default": "Yes"
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "analytics",
|
||||
|
|
|
@ -21,7 +21,7 @@ ynh_abort_if_errors
|
|||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
is_public=$YNH_APP_ARG_PUBLIC_SITE
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
analytics=$YNH_APP_ARG_ANALYTICS
|
||||
path_url="/"
|
||||
|
||||
|
@ -163,11 +163,11 @@ sudo yunohost service add "$app" --log "$logs_path/mattermost.log"
|
|||
#=================================================
|
||||
|
||||
ynh_app_setting_set "$app" is_public "$is_public"
|
||||
if [ "$is_public" = "Yes" ];
|
||||
then
|
||||
|
||||
if [[ $is_public == "1" ]]; then
|
||||
# Make the app accessible to the public
|
||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
||||
fi
|
||||
sudo yunohost app ssowatconf
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
|
@ -93,9 +93,12 @@ sudo chown -R mattermost:adm "$logs_path"
|
|||
# RESTORE SSOWAT
|
||||
#=================================================
|
||||
|
||||
if [ "$is_public" = "Yes" ];
|
||||
then
|
||||
if [[ $is_public == "1" ]]; then
|
||||
# Make the app accessible to the public
|
||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
||||
else
|
||||
# Remove the public access
|
||||
ynh_app_setting_delete "$app" skipped_uris
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -72,6 +72,18 @@ backup_config_file="/tmp/config.json"
|
|||
|
||||
sudo cp -f "$config_file" "$backup_config_file"
|
||||
|
||||
#=================================================
|
||||
# MIGRATE SETTINGS FROM PREVIOUS VERSIONS
|
||||
#=================================================
|
||||
|
||||
# Convert is_public from "Yes"/"No" to 1 / 0
|
||||
if [[ $is_public == "Yes" ]]; then
|
||||
is_public=1
|
||||
elif [[ $is_public == "No" ]]; then
|
||||
is_public=0
|
||||
fi
|
||||
ynh_app_setting_set "$app" is_public "$is_public"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue