diff --git a/scripts/install b/scripts/install index 84ca94a..3b3c3b0 100755 --- a/scripts/install +++ b/scripts/install @@ -15,7 +15,7 @@ admin_email=$(ynh_user_get_info --username="$admin" --key="mail") secret_key=$(ynh_string_random --length=64) staff_token=$(ynh_string_random --length=64) -ynh_app_setting_set --app="$app" --key="random_key" --value="$secret_key" +ynh_app_setting_set --app="$app" --key="secret_key" --value="$secret_key" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE diff --git a/scripts/upgrade b/scripts/upgrade index 7d079e9..dd25e53 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -7,6 +7,12 @@ source _common.sh source /usr/share/yunohost/helpers +#================================================= +# INITIALIZE AND STORE SETTINGS +#================================================= + +admin_email=$(ynh_user_get_info --username="$admin" --key="mail") + #================================================= # STOP SYSTEMD SERVICES #================================================= @@ -33,6 +39,12 @@ if [ -n "${data_path:-}" ]; then ynh_app_setting_delete --app="$app" --key=admin_email fi +if [[ -n "${random_key:-}" ]]; then + secret_key="$random_key" + ynh_app_setting_delete --app="$app" --key=random_key + ynh_app_setting_set --app="$app" --key=secret_key --value="$random_key" +fi + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -58,7 +70,6 @@ echo "django.core.mail.backends.console.EmailBackend" > "$env_path/EMAIL_BACKEND echo "$data_dir" > "$env_path/MEDIA_ROOT" echo "$secret_key" > "$env_path/SECRET_KEY" echo "$app@$domain" > "$env_path/SERVER_EMAIL" -echo "$staff_token" > "$env_path/STAFF_TOKEN" set_permissions