mirror of
https://github.com/YunoHost/example_ynh.git
synced 2024-09-03 20:06:13 +02:00
to not have misunderstanding between db_user and db_name
This commit is contained in:
parent
dcff494c9f
commit
ce94b06940
6 changed files with 11 additions and 5 deletions
|
@ -31,6 +31,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get $app db_name)
|
||||||
|
db_user=$(ynh_app_setting_get $app db_user)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD BACKUP STEPS
|
# STANDARD BACKUP STEPS
|
||||||
|
|
|
@ -31,6 +31,7 @@ final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
|
||||||
# Add settings here as needed by your application
|
# Add settings here as needed by your application
|
||||||
#db_name=$(ynh_app_setting_get "$app" db_name)
|
#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)
|
#db_pwd=$(ynh_app_setting_get $app db_pwd)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -108,7 +108,7 @@ ynh_install_app_dependencies deb1 deb2
|
||||||
ynh_print_info "Creating a MySQL database..."
|
ynh_print_info "Creating a MySQL database..."
|
||||||
|
|
||||||
### Use these lines if you need a database for the application.
|
### 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,
|
### The password will be stored as 'mysqlpwd' into the app settings,
|
||||||
### and will be available as $db_pwd
|
### and will be available as $db_pwd
|
||||||
### If you're not using these lines:
|
### 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
|
### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script
|
||||||
|
|
||||||
db_name=$(ynh_sanitize_dbid $app)
|
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_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
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
|
|
@ -19,7 +19,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
port=$(ynh_app_setting_get $app port)
|
port=$(ynh_app_setting_get $app port)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
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)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -32,6 +32,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)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
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
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
|
@ -95,8 +96,8 @@ ynh_install_app_dependencies deb1 deb2
|
||||||
ynh_print_info "Restoring the MySQL database..."
|
ynh_print_info "Restoring the MySQL database..."
|
||||||
|
|
||||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||||
ynh_mysql_setup_db $db_name $db_name $db_pwd
|
ynh_mysql_setup_db $db_user $db_name $db_pwd
|
||||||
ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
|
ynh_mysql_connect_as $db_user $db_pwd $db_name < ./db.sql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
|
|
|
@ -23,6 +23,7 @@ is_public=$(ynh_app_setting_get $app is_public)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
language=$(ynh_app_setting_get $app language)
|
language=$(ynh_app_setting_get $app language)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get $app db_name)
|
||||||
|
db_user=$(ynh_app_setting_get $app db_user)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
|
|
Loading…
Add table
Reference in a new issue