aboutsummaryrefslogtreecommitdiff
path: root/scripts/upgrade
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/upgrade')
-rw-r--r--scripts/upgrade16
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/upgrade b/scripts/upgrade
index 46e7229..fe6f331 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -37,6 +37,9 @@ otp_secret=$(ynh_app_setting_get --app=$app --key=otp_secret)
vapid_private_key=$(ynh_app_setting_get --app=$app --key=vapid_private_key)
vapid_public_key=$(ynh_app_setting_get --app=$app --key=vapid_public_key)
+ldap_user=$(ynh_app_setting_get --app=$app --key=ldap_user)
+ldap_password=$(ynh_app_setting_get --app=$app --key=ldap_password)
+
#=================================================
# CHECK VERSION
#=================================================
@@ -122,6 +125,16 @@ if [[ -z "$vapid_private_key" ]]; then
ynh_app_setting_set "$app" vapid_public_key "$vapid_public_key"
fi
+# If ldap_user doesn't exist, retrieve it or create it
+if [[ -z "$ldap_user" ]]; then
+ ldap_user="svc_${app}_ldap"
+ ldap_password==$(ynh_string_random --length=8)
+ ynh_app_setting_set "$app" ldap_user "$ldap_user"
+ ynh_app_setting_set "$app" ldap_password "$ldap_password"
+
+ yunohost user create $ldap_user --firstname "SvcMastodonLdap" --lastname "SvcMastodonLdap" --mail ${ldap_user}@$domain --password $ldap_password -q 0
+fi
+
#Remove previous added repository
ynh_remove_extra_repo
@@ -239,6 +252,9 @@ ynh_replace_string --match_string="__OTP_SECRET__" --replace_string="$otp_secret
ynh_replace_string "__VAPID_PRIVATE_KEY__" "$vapid_private_key" "$final_path/live/.env.production"
ynh_replace_string "__VAPID_PUBLIC_KEY__" "$vapid_public_key" "$final_path/live/.env.production"
+ynh_replace_string --match_string="__LDAP_USER__" --replace_string="$ldap_user" --target_file="$final_path/live/.env.production"
+ynh_replace_string --match_string="__LDAP_PASSWORD__" --replace_string="$ldap_password" --target_file="$final_path/live/.env.production"
+
#=================================================
# UPGRADE MASTODON
#=================================================