to not have misunderstanding between db_user and db_name

This commit is contained in:
toitoinebzh 2019-02-27 23:41:35 +01:00
parent dcff494c9f
commit ce94b06940
6 changed files with 11 additions and 5 deletions

View file

@ -31,6 +31,7 @@ app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path)
domain=$(ynh_app_setting_get $app domain)
db_name=$(ynh_app_setting_get $app db_name)
db_user=$(ynh_app_setting_get $app db_user)
#=================================================
# STANDARD BACKUP STEPS

View file

@ -31,6 +31,7 @@ final_path=$(ynh_app_setting_get $app final_path)
# Add settings here as needed by your application
#db_name=$(ynh_app_setting_get "$app" db_name)
#db_user=$(ynh_app_setting_get "$app" db_user)
#db_pwd=$(ynh_app_setting_get $app db_pwd)
#=================================================

View file

@ -108,7 +108,7 @@ ynh_install_app_dependencies deb1 deb2
ynh_print_info "Creating a MySQL database..."
### Use these lines if you need a database for the application.
### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password.
### `ynh_mysql_setup_db` will create a database, an associated user 'db_user' and a random password.
### The password will be stored as 'mysqlpwd' into the app settings,
### and will be available as $db_pwd
### If you're not using these lines:
@ -117,8 +117,10 @@ ynh_print_info "Creating a MySQL database..."
### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script
db_name=$(ynh_sanitize_dbid $app)
db_user="user_"$db_name
ynh_app_setting_set $app db_user $db_user
ynh_app_setting_set $app db_name $db_name
ynh_mysql_setup_db $db_name $db_name
ynh_mysql_setup_db $db_user $db_name
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE

View file

@ -19,7 +19,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
port=$(ynh_app_setting_get $app port)
db_name=$(ynh_app_setting_get $app db_name)
db_user=$db_name
db_user=$(ynh_app_setting_get $app db_user)
final_path=$(ynh_app_setting_get $app final_path)
#=================================================

View file

@ -32,6 +32,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)
db_name=$(ynh_app_setting_get $app db_name)
db_user=$(ynh_app_setting_get $app db_user)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -95,8 +96,8 @@ ynh_install_app_dependencies deb1 deb2
ynh_print_info "Restoring the MySQL database..."
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
ynh_mysql_setup_db $db_name $db_name $db_pwd
ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
ynh_mysql_setup_db $db_user $db_name $db_pwd
ynh_mysql_connect_as $db_user $db_pwd $db_name < ./db.sql
#=================================================
# RESTORE SYSTEMD

View file

@ -23,6 +23,7 @@ is_public=$(ynh_app_setting_get $app is_public)
final_path=$(ynh_app_setting_get $app final_path)
language=$(ynh_app_setting_get $app language)
db_name=$(ynh_app_setting_get $app db_name)
db_user=$(ynh_app_setting_get $app db_user)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY