diff --git a/scripts/change_url b/scripts/change_url index ff06606..ca9c1e1 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -29,6 +29,10 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$db_name +db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) + #================================================= # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= @@ -91,6 +95,19 @@ then ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 + +domain=$new_domain +path=$new_path +key=$(ynh_app_setting_get --app=$app --key=key) +ynh_add_config --template="../conf/.env.example" --destination="$final_path/.env" + +chmod 400 "$final_path/.env" +chown $app:$app "$final_path/.env" + #================================================= # RELOAD NGINX #================================================= diff --git a/scripts/install b/scripts/install index e64e3f2..3abcf87 100755 --- a/scripts/install +++ b/scripts/install @@ -49,6 +49,7 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url +ynh_app_setting_set --app=$app --key=key --value=$key #================================================= # CREATE DEDICATED USER diff --git a/scripts/upgrade b/scripts/upgrade index cfc21e5..397edbb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -41,23 +41,6 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - -# If db_name doesn't exist, create it -#if [ -z "$db_name" ]; then -# db_name=$(ynh_sanitize_dbid --db_name=$app) -# ynh_app_setting_set --app=$app --key=db_name --value=$db_name -#fi - -# If final_path doesn't exist, create it -#if [ -z "$final_path" ]; then -# final_path=/var/www/$app -# ynh_app_setting_set --app=$app --key=final_path --value=$final_path -#fi - #================================================= # CREATE DEDICATED USER #=================================================