1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mastodon_ynh.git synced 2024-09-03 19:46:02 +02:00

Add $db_pwd compatibility

This commit is contained in:
nemsia 2018-06-21 11:08:52 +02:00
parent 6a4ca2a0e6
commit f13690c38b

View file

@ -50,6 +50,14 @@ if [[ "$admin" = "" || "$language" = "" ]]; then
ynh_die
fi
# If db_pwd doesn't exist, create it, need for old install
if [[ -z "$db_pwd" ]]; then
db_pwd=$(ynh_string_random)
ynh_app_setting_set $app db_pwd $db_pwd
ynh_psql_test_if_first_run
sudo --login --user=postgres psql -c"ALTER user $app WITH PASSWORD '$db_pwd'" postgres
sed -i "s@DB_PASS=@DB_PASS=${db_pwd}@g" "${final_path}/live/.env.production"
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP