From 96b513880d9bf143cb3bd881172dc52bb9d4dbe4 Mon Sep 17 00:00:00 2001 From: liberodark Date: Fri, 4 Jan 2019 16:52:59 +0100 Subject: [PATCH] add db --- conf/config.json | 6 +++--- scripts/install | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/conf/config.json b/conf/config.json index a0e7ec9..fd3b043 100644 --- a/conf/config.json +++ b/conf/config.json @@ -1,9 +1,9 @@ { "mysql": { "host": "localhost", - "database": "pufferpanel", - "username": "pufferpanel", - "password": "__DB_PASS__", + "database": "yunobase", + "username": "yunouser", + "password": "yunopass", "port": "3306" } } \ No newline at end of file diff --git a/scripts/install b/scripts/install index 7165fa8..ef83dd1 100644 --- a/scripts/install +++ b/scripts/install @@ -99,6 +99,16 @@ ynh_package_install debian-archive-keyring apt-transport-https openssl curl mysq #echo "deb-src https://packagecloud.io/pufferpanel/pufferd/debian/ stretch main" >> /etc/apt/sources.list.d/pufferpanel_pufferd.list #apt-get update +#================================================= +# CREATE A MYSQL DATABASE +#================================================= +# If your app uses a MySQL database, you can use these lines to bootstrap +# a database, an associated user and save the password in app settings + +db_name=$(ynh_sanitize_dbid $app) +ynh_app_setting_set $app db_name $db_name +ynh_mysql_setup_db $db_name $db_name + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -107,6 +117,28 @@ ynh_app_setting_set $app final_path $final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source "$final_path" + +#================================================= +# SPECIFIC SETUP +#================================================= + +# create a user +email=$(ynh_user_get_info $admin 'mail') + +# setup application config +cp -a ../conf/config.json $final_path/config.json + +#================================================= +# MODIFY A CONFIG FILE +#================================================= + +#ynh_replace_string "random_key" "$random_key" "$final_path/.env" +ynh_replace_string "yunouser" "$db_name" "$final_path/config.json" +ynh_replace_string "yunopass" "$db_pwd" "$final_path/config.json" +ynh_replace_string "yunobase" "$db_name" "$final_path/config.json" +#ynh_replace_string "yunomail" "$email" "$final_path/config.json" +#ynh_replace_string "yunodomain" "$domain" "$final_path/.env" + #============================================== # INSTALL PufferPanel #==============================================