diff --git a/conf/.env.example b/conf/.env.example index b7c1110..1d62d3d 100644 --- a/conf/.env.example +++ b/conf/.env.example @@ -7,7 +7,7 @@ # wrap the entire value in quotes. (eg. MAIL_FROM_NAME="BookStack Mailer") # Application key -APP_KEY=SomeRandomString +APP_KEY=__KEY__ # Application URL APP_URL=https://__DOMAIN____PATH__ diff --git a/scripts/install b/scripts/install index 1a7a80d..e6c0800 100644 --- a/scripts/install +++ b/scripts/install @@ -120,6 +120,7 @@ ynh_install_composer --phpversion=$phpversion --workdir=$final_path --install_ar redis_db=$(ynh_redis_get_free_db) ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" mail_pwd=$(ynh_string_random --length=12) +key=$(ynh_string_random --length=12) ynh_add_config --template=../conf/.env.example --destination=$final_path/.env chmod 600 $final_path/.env diff --git a/scripts/upgrade b/scripts/upgrade index ac26ebf..9867e38 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,6 +24,8 @@ 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) phpversion=$YNH_PHP_VERSION +redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) +mail_pwd=$(ynh_string_random --length=12) #================================================= # CHECK VERSION @@ -64,7 +66,7 @@ then # Create a temporary directory tmpdir="$(mktemp -d)" - cp -a "$final_path/.env " "$tmpdir/.env " + #cp -a "$final_path/.env " "$tmpdir/.env " cp -a "$final_path/public/uploads" "$tmpdir/public/uploads" cp -a "$final_path/storage/uploads" "$tmpdir/storage/uploads" # Remove the app directory securely @@ -73,7 +75,7 @@ then # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" - cp -a "$tmpdir/.env " "$final_path/.env " + #cp -a "$tmpdir/.env " "$final_path/.env " cp -a "$tmpdir/public/uploads" "$final_path/public/uploads" cp -a "$tmpdir/storage/uploads" "$final_path/storage/uploads" @@ -81,7 +83,10 @@ then ynh_secure_remove --file="$tmpdir" # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" #--keep="$final_path/.env $final_path/public/uploads $final_path/storage/uploads" + ynh_setup_source --dest_dir="$final_path" + + ynh_add_config --template=../conf/.env.example --destination=$final_path/.env + chmod 600 $final_path/.env fi chmod 755 $final_path