1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pixelfed_ynh.git synced 2024-09-03 20:06:04 +02:00

fix app_key

This commit is contained in:
yalh76 2019-04-12 03:40:31 +02:00
parent 0511966540
commit 71beeacef0
2 changed files with 11 additions and 2 deletions

View file

@ -23,7 +23,8 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url="/"
is_public=$YNH_APP_ARG_IS_PUBLIC
app_key=$(ynh_string_random 32)
app_key=$(ynh_string_random 32 | base64)
app_key="base64:$app_key"
app=$YNH_APP_INSTANCE_NAME

View file

@ -25,6 +25,7 @@ language=$(ynh_app_setting_get "$app" language)
db_name=$(ynh_app_setting_get "$app" db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get "$app" db_pwd)
app_key=$(ynh_app_setting_get "$app" app_key)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
@ -52,6 +53,12 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set "$app" final_path "$final_path"
fi
# If app_key doesn't exist, retrieve it
if [ -z "$app_key" ]; then
app_key=$(grep -oP "APP_KEY=\Kbase64.*" "$final_path/.env")
ynh_app_setting_set "$app" app_key "$app_key"
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -141,9 +148,10 @@ ynh_install_composer --workdir="$final_path"
#=================================================
config="$final_path/.env"
cp -f ../conf/.env "$config"
cp ../conf/.env "$config"
ynh_replace_string "__APP__" "$app" "$config"
ynh_replace_string "__APP_KEY__" "$app_key" "$config"
ynh_replace_string "__DOMAIN__" "$domain" "$config"
ynh_replace_string "__PATH__" "$path_url" "$config"
ynh_replace_string "__DB_NAME__" "$db_name" "$config"