diff --git a/conf/.env b/conf/.env index 1ff548c..32f4820 100644 --- a/conf/.env +++ b/conf/.env @@ -5,5 +5,5 @@ projects_database_name=dontCodeProjects quarkus_mongodb_data_connection_string=mongodb://localhost:27017 data_database_name=dontCodeData -document_directory=__DOCUMENT_PATH__ +document_directory=__DOCUMENT_DIR__ document_external_url=__DOCUMENT_URL__ diff --git a/conf/systemd.service b/conf/systemd.service index 8ca9fd4..baf78b7 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -19,7 +19,7 @@ StandardError=inherit # Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html # Enable the writing of uploaded documents -ReadWritePaths=__DOCUMENT_PATH__ +ReadWritePaths=__DOCUMENT_DIR__ NoNewPrivileges=yes PrivateTmp=yes PrivateDevices=yes diff --git a/scripts/install b/scripts/install index 4bba393..cf5fa2b 100755 --- a/scripts/install +++ b/scripts/install @@ -29,8 +29,8 @@ chown "$app:$app" /var/log/$app #================================================= ynh_script_progression --message="Configuring document storage..." --weight=1 -document_path=$data_dir/docs -ynh_app_setting_set --app="$app" --key=document_path --value="$document_path" +document_dir=$data_dir/docs +ynh_app_setting_set --app="$app" --key=document_dir --value="$document_dir" document_url=$(append_uri "https://${domain}${path}" "docs") ynh_app_setting_set --app="$app" --key=document_url --value="$document_url" diff --git a/scripts/restore b/scripts/restore index ce139ae..1532db5 100755 --- a/scripts/restore +++ b/scripts/restore @@ -31,7 +31,7 @@ ynh_script_progression --message="Restoring the document storage..." --weight=1 ynh_restore_file --origin_path="$data_dir" --not_mandatory -mkdir -p $document_path +mkdir -p $document_dir chmod -R o-rwx "$data_dir" chown -R $app:www-data "$data_dir" diff --git a/scripts/upgrade b/scripts/upgrade index d58583c..54ae12c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -28,9 +28,17 @@ done #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +if [[ -n "$document_path" ]]; then + # Renamed setting key + document_dir="$document_path" + ynh_app_setting_delete --app="$app" --key=document_path + ynh_app_setting_set --app="$app" --key=document_dir --value="$document_dir" +fi + if [[ -n "${html_path:-}" ]]; then # Migrate html_path to data_dir mv "$html_path/index.html" "$html_path/docs" "$data_dir" + old_doc_dir="$html_path/docs" ynh_secure_remove --file="$html_path" ynh_app_setting_delete --app="$app" --key=html_path # FIXME: other settings @@ -40,7 +48,7 @@ if [[ -n "${html_path:-}" ]]; then # Update the path in .env file ynh_backup_if_checksum_is_different --file="$install_dir/.env" - ynh_replace_string --match_string="$old_doc_path" --replace_string="$document_path" --target_file="$install_dir/.env" + ynh_replace_string --match_string="$old_doc_dir" --replace_string="$document_dir" --target_file="$install_dir/.env" ynh_store_file_checksum --file="$install_dir/.env" fi