mirror of
https://github.com/YunoHost-Apps/snserver_ynh.git
synced 2024-09-03 20:26:22 +02:00
fix upgrade
This commit is contained in:
parent
c0cc162d1f
commit
a7ec7c8bef
2 changed files with 41 additions and 48 deletions
|
@ -3,25 +3,25 @@ version = "1.0"
|
||||||
[main]
|
[main]
|
||||||
name = "StandardNotes Server configuration"
|
name = "StandardNotes Server configuration"
|
||||||
|
|
||||||
[main.new_user]
|
[main.new_user]
|
||||||
name = "New User Options"
|
name = "New User Options"
|
||||||
|
|
||||||
[main.new_user.disable_user_registration]
|
[main.new_user.disable_user_registration]
|
||||||
ask = "Disable user registration?"
|
ask = "Disable user registration?"
|
||||||
type = "boolean"
|
type = "boolean"
|
||||||
default = "false"
|
default = "false"
|
||||||
help = "false = New users can register\ntrue = No new user registrations allowed"
|
help = "false = New users can register\ntrue = No new user registrations allowed"
|
||||||
|
|
||||||
[main.new_user.files_limit]
|
[main.new_user.files_limit]
|
||||||
ask = "Default files limit"
|
ask = "Default files limit"
|
||||||
type = "number"
|
type = "number"
|
||||||
default = "100"
|
default = "100"
|
||||||
help = "Choose a default limit in MB for the user file upload space.\n 100 = 100 MB\n 1024 = 1GB\n 10240 = 10GB"
|
help = "Choose a default limit in MB for the user file upload space.\n 100 = 100 MB\n 1024 = 1GB\n 10240 = 10GB"
|
||||||
|
|
||||||
[main.subscription]
|
[main.subscription]
|
||||||
name = "User Subscription"
|
name = "User Subscription"
|
||||||
|
|
||||||
[main.subscription.info]
|
[main.subscription.info]
|
||||||
ask = ""
|
ask = ""
|
||||||
type = "alert"
|
type = "alert"
|
||||||
style = "info"
|
style = "info"
|
||||||
|
|
|
@ -51,62 +51,55 @@ ynh_systemd_action \
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
# If jwt_secret doesn't exist, create it
|
# Create non existing settings
|
||||||
if [ -z "$jwt_secret" ]; then
|
if [ -z "${jwt_secret:-}" ]; then
|
||||||
jwt_secret=$(ynh_string_random --length=48 | base64)
|
jwt_secret=$(ynh_string_random --length=48 | base64)
|
||||||
ynh_app_setting_set --app=$app --key=jwt_secret --value=$jwt_secret
|
ynh_app_setting_set --app="$app" --key=jwt_secret --value="$jwt_secret"
|
||||||
fi
|
fi
|
||||||
# If legacy_jwt_secret doesn't exist, create it
|
if [ -z "${legacy_jwt_secret:-}" ]; then
|
||||||
if [ -z "$legacy_jwt_secret" ]; then
|
|
||||||
legacy_jwt_secret=$(ynh_string_random --length=48 | base64)
|
legacy_jwt_secret=$(ynh_string_random --length=48 | base64)
|
||||||
ynh_app_setting_set --app=$app --key=legacy_jwt_secret --value=$legacy_jwt_secret
|
ynh_app_setting_set --app="$app" --key=legacy_jwt_secret --value="$legacy_jwt_secret"
|
||||||
fi
|
fi
|
||||||
# If auth_jwt_secret doesn't exist, create it
|
if [ -z "${auth_jwt_secret:-}" ]; then
|
||||||
if [ -z "$auth_jwt_secret" ]; then
|
|
||||||
auth_jwt_secret=$(ynh_string_random --length=48 | base64)
|
auth_jwt_secret=$(ynh_string_random --length=48 | base64)
|
||||||
ynh_app_setting_set --app=$app --key=auth_jwt_secret --value=$auth_jwt_secret
|
ynh_app_setting_set --app="$app" --key=auth_jwt_secret --value="$auth_jwt_secret"
|
||||||
fi
|
fi
|
||||||
# If pseudo_key_params_key doesn't exist, create it
|
if [ -z "${pseudo_key_params_key:-}" ]; then
|
||||||
if [ -z "$pseudo_key_params_key" ]; then
|
|
||||||
pseudo_key_params_key=$(ynh_string_random --length=48 | base64)
|
pseudo_key_params_key=$(ynh_string_random --length=48 | base64)
|
||||||
ynh_app_setting_set --app=$app --key=pseudo_key_params_key --value=$pseudo_key_params_key
|
ynh_app_setting_set --app="$app" --key=pseudo_key_params_key --value="$pseudo_key_params_key"
|
||||||
fi
|
fi
|
||||||
# If encryption_server_key doesn't exist, create it
|
if [ -z "${encryption_server_key:-}" ]; then
|
||||||
if [ -z "$encryption_server_key" ]; then
|
|
||||||
encryption_server_key=$(hexdump -n 32 -e '4/4 "%08X"' /dev/random) # 32bytes hex key is required
|
encryption_server_key=$(hexdump -n 32 -e '4/4 "%08X"' /dev/random) # 32bytes hex key is required
|
||||||
ynh_app_setting_set --app=$app --key=encryption_server_key --value=$encryption_server_key
|
ynh_app_setting_set --app="$app" --key=encryption_server_key --value="$encryption_server_key"
|
||||||
fi
|
fi
|
||||||
# If valet_token_secret doesn't exist, create it
|
if [ -z "${valet_token_secret:-}" ]; then
|
||||||
if [ -z "$valet_token_secret" ]; then
|
|
||||||
valet_token_secret=$(ynh_string_random --length=48 | base64)
|
valet_token_secret=$(ynh_string_random --length=48 | base64)
|
||||||
ynh_app_setting_set --app=$app --key=valet_token_secret --value=$valet_token_secret
|
ynh_app_setting_set --app="$app" --key=valet_token_secret --value="$valet_token_secret"
|
||||||
fi
|
fi
|
||||||
# If disable_user_registration doesn't exist, create it
|
if [ -z "${disable_user_registration:-}" ]; then
|
||||||
if [ -z "$disable_user_registration" ]; then
|
|
||||||
disable_user_registration=false
|
disable_user_registration=false
|
||||||
ynh_app_setting_set --app=$app --key=DISABLE_USER_REGISTRATION --value=$disable_user_registration
|
ynh_app_setting_set --app="$app" --key=DISABLE_USER_REGISTRATION --value="$disable_user_registration"
|
||||||
fi
|
fi
|
||||||
# If files_zise doesn't exist, create it
|
if [ -z "${files_size:-}" ]; then
|
||||||
if [ -z "$files_size" ]; then
|
|
||||||
files_size=100
|
files_size=100
|
||||||
ynh_app_setting_set --app=$app --key=FILES_SIZE --value=$files_size
|
ynh_app_setting_set --app="$app" --key=FILES_SIZE --value="$files_size"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Delete legacy settings
|
||||||
if [ -n "${api_gateway_version_installed+x}" ]; then
|
if [ -n "${api_gateway_version_installed+x}" ]; then
|
||||||
ynh_app_setting_delete --app=$app --key=api_gateway_version_installed
|
ynh_app_setting_delete --app="$app" --key=api_gateway_version_installed
|
||||||
fi
|
fi
|
||||||
if [ -n "${auth_version_installed+x}" ]; then
|
if [ -n "${auth_version_installed+x}" ]; then
|
||||||
ynh_app_setting_delete --app=$app --key=auth_version_installe
|
ynh_app_setting_delete --app="$app" --key=auth_version_installe
|
||||||
fi
|
fi
|
||||||
if [ -n "${syncing_server_version_installed+x}" ]; then
|
if [ -n "${syncing_server_version_installed+x}" ]; then
|
||||||
ynh_app_setting_delete --app=$app --key=syncing_server_version_installed
|
ynh_app_setting_delete --app="$app" --key=syncing_server_version_installed
|
||||||
fi
|
fi
|
||||||
if [ -n "${install_dir_www+x}" ]; then
|
if [ -n "${install_dir_www+x}" ]; then
|
||||||
ynh_app_setting_delete --app=$app --key=install_dir_www
|
ynh_app_setting_delete --app="$app" --key=install_dir_www
|
||||||
fi
|
fi
|
||||||
# If install_dir_extensions exist, delete it
|
|
||||||
if [ -n "${install_dir_extensions+x}" ]; then
|
if [ -n "${install_dir_extensions+x}" ]; then
|
||||||
ynh_app_setting_delete --app=$app --key=install_dir_extensions
|
ynh_app_setting_delete --app="$app" --key=install_dir_extensions
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If old service exsits; remove it
|
# If old service exsits; remove it
|
||||||
|
|
Loading…
Reference in a new issue