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

if no db then create it

This commit is contained in:
Kayou 2019-02-03 20:03:25 +01:00
parent 1172d4f924
commit 001599224e
No known key found for this signature in database
GPG key ID: 823A2CBE071D3126
2 changed files with 11 additions and 4 deletions

View file

@ -101,8 +101,6 @@ ynh_setup_source "$final_path"
# NGINX CONFIGURATION
#=================================================
### `ynh_add_nginx_config` will use the file conf/nginx.conf
# Create a dedicated nginx config
ynh_add_nginx_config

View file

@ -55,8 +55,17 @@ fi
if [ -z "$db_pwd" ]; then
db_pwd=$(ynh_app_setting_get $app db_pwd) # Fix old db_pwd
ynh_app_setting_delete $app db_pwd
ynh_app_setting_set $app psqlpwd $db_pwd
if [ -z "$db_pwd" ]; then
db_name=$(ynh_sanitize_dbid "$app")
db_user=$db_name
# Initialize database and store postgres password for upgrade
ynh_psql_setup_db "$db_name" "$db_user"
ynh_app_setting_set "$app" db_name "$db_name"
db_pwd=$(ynh_app_setting_get $app psqlpwd) # Password created in ynh_psql_setup_db function
else
ynh_app_setting_delete $app db_pwd
ynh_app_setting_set $app psqlpwd $db_pwd
fi
fi
#=================================================