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

don't generate psql password

the help will do it for us
also, I moved the variable definition close to usage
This commit is contained in:
Jean-Baptiste Holcroft 2020-05-01 14:55:01 +02:00
parent eba1b18160
commit e16ed36e9d
3 changed files with 9 additions and 15 deletions

View file

@ -60,17 +60,11 @@ ynh_app_setting_set "$app" path "$path_url"
# DEFAULT SETTINGS # DEFAULT SETTINGS
#================================================= #=================================================
db_name="$app"
db_user="$app"
port=$(ynh_find_port 9876) port=$(ynh_find_port 9876)
salt=$(ynh_string_random 40) salt=$(ynh_string_random 40)
db_pwd=$(ynh_string_random 40)
ynh_app_setting_set "$app" port "$port" ynh_app_setting_set "$app" port "$port"
ynh_app_setting_set "$app" salt "$salt" ynh_app_setting_set "$app" salt "$salt"
ynh_print_OFF
ynh_app_setting_set "$app" db_pwd "$db_pwd"
ynh_print_ON
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
@ -148,8 +142,12 @@ ynh_use_nodejs
# Setup Kresus postgresql database # Setup Kresus postgresql database
#================================================= #=================================================
db_name="$app"
db_user="$app"
ynh_psql_test_if_first_run ynh_psql_test_if_first_run
ynh_psql_setup_db "$db_user" "$db_name" "$db_pwd" ynh_psql_setup_db "$db_user" "$db_name"
db_pwd=$(ynh_app_setting_get "$app" psqlpwd)
#================================================= #=================================================
# CONFIGURE KRESUS # CONFIGURE KRESUS

View file

@ -30,7 +30,7 @@ domain=$(ynh_app_setting_get "$app" domain)
path_url=$(ynh_app_setting_get "$app" path) path_url=$(ynh_app_setting_get "$app" path)
final_path=$(ynh_app_setting_get "$app" final_path) final_path=$(ynh_app_setting_get "$app" final_path)
salt=$(ynh_app_setting_get "$app" salt) salt=$(ynh_app_setting_get "$app" salt)
db_pwd=$(ynh_app_setting_get "$app" db_pwd) db_pwd=$(ynh_app_setting_get "$app" psqlpwd)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED

View file

@ -26,7 +26,7 @@ path_url=$(ynh_app_setting_get "$app" path)
final_path=$(ynh_app_setting_get "$app" final_path) final_path=$(ynh_app_setting_get "$app" final_path)
port=$(ynh_app_setting_get "$app" port) port=$(ynh_app_setting_get "$app" port)
salt=$(ynh_app_setting_get "$app" salt) salt=$(ynh_app_setting_get "$app" salt)
db_pwd=$(ynh_app_setting_get "$app" db_pwd) db_pwd=$(ynh_app_setting_get "$app" psqlpwd)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
@ -49,13 +49,9 @@ if [ -z "$salt" ]; then
fi fi
if [ -z "$db_pwd" ]; then if [ -z "$db_pwd" ]; then
ynh_print_OFF
db_pwd=$(ynh_string_random 40)
ynh_app_setting_set "$app" db_pwd "$db_pwd"
ynh_print_ON
ynh_psql_test_if_first_run ynh_psql_test_if_first_run
ynh_psql_setup_db "$db_user" "$db_name" "$db_pwd" ynh_psql_setup_db "$db_user" "$db_name"
db_pwd=$(ynh_app_setting_get "$app" psqlpwd)
fi fi
#================================================= #=================================================