mirror of
https://github.com/YunoHost-Apps/glitchsoc_ynh.git
synced 2024-09-03 19:15:59 +02:00
Add pg user pass on upgrade
This commit is contained in:
parent
c9429cbf23
commit
2bd8279988
1 changed files with 10 additions and 0 deletions
|
@ -16,6 +16,7 @@ source /usr/share/yunohost/helpers
|
||||||
# See comments in install script
|
# See comments in install script
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
db_name=$(ynh_app_setting_get "$app" db_name)
|
db_name=$(ynh_app_setting_get "$app" db_name)
|
||||||
|
db_pwd=$(ynh_app_setting_get "$app" db_pwd)
|
||||||
|
|
||||||
# Retrieve app settings
|
# Retrieve app settings
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
|
@ -47,6 +48,15 @@ if [[ "$admin" = "" || "$language" = "" ]]; then
|
||||||
ynh_die
|
ynh_die
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If db_pwd doesn't exist, create it
|
||||||
|
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
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue