diff --git a/conf/.env.example b/conf/.env.example index ce3c712..7ea94e6 100644 --- a/conf/.env.example +++ b/conf/.env.example @@ -26,14 +26,14 @@ DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=__DB_NAME__ DB_USERNAME=__DB_NAME__ -DB_PASSWORD=__DB_PASS__ +DB_PASSWORD=__DB_PWD__ DB_LOG_SQL=false TIMEZONE=UTC # folders in which the files will be stored -LYCHEE_DIST="__FINALPATH__/public/dist/" -LYCHEE_UPLOADS="__PUBLICPATH__/uploads/" +LYCHEE_DIST="__FINAL_PATH__/public/dist/" +LYCHEE_UPLOADS="__PUBLIC_PATH__/uploads/" # url to access those files # LYCHEE_DIST_URL="dist/" diff --git a/scripts/install b/scripts/install index 52dee2c..c6aa4fe 100755 --- a/scripts/install +++ b/scripts/install @@ -79,8 +79,8 @@ ynh_setup_source --dest_dir=$final_path if [ -z "/home/yunohost.app/$app" ]; then public_path=/home/yunohost.app/$app ynh_app_setting_set --app=$app --key=public_path --value=$public_path - mkdir -p ${public_path}/uploads - mkdir -p ${public_path}/uploads/{big,import,medium,raw,small,thumb} + mkdir -p $public_path/uploads + mkdir -p $public_path/uploads/{big,import,medium,raw,small,thumb} else ynh_die --message="This path already contains a folder" fi @@ -119,12 +119,8 @@ ynh_install_composer --phpversion=$phpversion --workdir=$final_path --install_ar ynh_script_progression --message="Building..." # Setup application config -cp ../conf/.env.example $final_path/.env - -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/.env" -ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="$final_path/.env" -ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$final_path/.env" -ynh_replace_string --match_string="__PUBLICPATH__" --replace_string="$public_path" --target_file="$final_path/.env" +ynh_add_config --template="../conf/.env.example" --destination="$final_path/.env" +ynh_store_file_checksum "$final_path/.env" # Setup application config pushd $final_path diff --git a/scripts/upgrade b/scripts/upgrade index a6cd936..571a680 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -155,13 +155,9 @@ ynh_install_composer --phpversion=${phpversion} --workdir=$final_path --install_ ynh_script_progression --message="Building..." ynh_backup_if_checksum_is_different --file="$final_path/.env" -# Setup application config -cp ../conf/.env.example $final_path/.env -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/.env" -ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="$final_path/.env" -ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$final_path/.env" -ynh_replace_string --match_string="__PUBLICPATH__" --replace_string="$public_path" --target_file="$final_path/.env" +# Setup application config +ynh_add_config --template="../conf/.env.example" --destination="$final_path/.env" # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="$final_path/.env"