diff --git a/scripts/install b/scripts/install index ad3788f..fd6726b 100644 --- a/scripts/install +++ b/scripts/install @@ -60,17 +60,11 @@ ynh_app_setting_set "$app" path "$path_url" # DEFAULT SETTINGS #================================================= -db_name="$app" -db_user="$app" port=$(ynh_find_port 9876) salt=$(ynh_string_random 40) -db_pwd=$(ynh_string_random 40) ynh_app_setting_set "$app" port "$port" ynh_app_setting_set "$app" salt "$salt" -ynh_print_OFF -ynh_app_setting_set "$app" db_pwd "$db_pwd" -ynh_print_ON #================================================= # STANDARD MODIFICATIONS @@ -148,8 +142,12 @@ ynh_use_nodejs # Setup Kresus postgresql database #================================================= +db_name="$app" +db_user="$app" + 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 diff --git a/scripts/restore b/scripts/restore index 05f43bc..c4819c3 100644 --- a/scripts/restore +++ b/scripts/restore @@ -30,7 +30,7 @@ domain=$(ynh_app_setting_get "$app" domain) path_url=$(ynh_app_setting_get "$app" path) final_path=$(ynh_app_setting_get "$app" final_path) 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 diff --git a/scripts/upgrade b/scripts/upgrade index 8402bb0..78de529 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -26,7 +26,7 @@ path_url=$(ynh_app_setting_get "$app" path) final_path=$(ynh_app_setting_get "$app" final_path) port=$(ynh_app_setting_get "$app" port) 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 @@ -49,13 +49,9 @@ if [ -z "$salt" ]; then fi 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_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 #=================================================