From 45c87bc854d28837100740bf109010658fc0633f Mon Sep 17 00:00:00 2001 From: Cid Lopes Date: Tue, 19 Aug 2025 12:42:57 +0300 Subject: [PATCH 1/3] Fix v in release version --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bee54a7..7b43736 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,7 +45,8 @@ jobs: run: | git config user.name github-actions[bot] git config user.email github-actions[bot]@users.noreply.github.com - git tag -a "v${{ steps.get_version.outputs.version }}" -m "Release version ${{ steps.get_version.outputs.version }}" + git tag -a "${{ steps.get_version.outputs.version }}" -m "Release version ${{ steps.get_version.outputs.version }}" + git push origin "${{ steps.get_version.outputs.version }}" - name: Extract changelog for version id: changelog From 60f645b6f4c3b9b7346633db2287bd904d61666c Mon Sep 17 00:00:00 2001 From: Kim Sandell Date: Wed, 25 Mar 2026 06:24:47 +0100 Subject: [PATCH 2/3] docs: document storagePath and sharedStoragePath - Rewrite Storage-folders.md with correct base path, accurate fallback behavior, and storage.shared config example - Add storage section to Configuration.md - Improve docblocks on sharedStoragePath in Application.php and ApplicationInterface.php --- doc/User-Guide/Configuration.md | 18 ++++++++++ doc/User-Guide/Storage-folders.md | 60 +++++++++++++++++++++++++++---- src/Application.php | 11 +++++- src/ApplicationInterface.php | 12 +++++-- 4 files changed, 90 insertions(+), 11 deletions(-) diff --git a/doc/User-Guide/Configuration.md b/doc/User-Guide/Configuration.md index 578f407..530f68e 100644 --- a/doc/User-Guide/Configuration.md +++ b/doc/User-Guide/Configuration.md @@ -307,6 +307,24 @@ The 1st connection in the `"connections"` array is the **default**, and does not } ``` +### Storage Configuration + +Controls the shared storage path used by `app()->getSharedStoragePath()`. + +```json +{ + "storage": { + "shared": "${env:SHARED_STORAGE_PATH}" + } +} +``` + +| Key | Description | +|-----|-------------| +| `shared` | Base path for shared storage. The framework appends `/{environment}/{appCode}` to form the final path. Leave empty or omit to use local `{basePath}/storage` instead. | + +See [Storage Folders](Storage-folders.md) for full details. + ### Factory Configuration ```json diff --git a/doc/User-Guide/Storage-folders.md b/doc/User-Guide/Storage-folders.md index e64ca45..dafdda0 100644 --- a/doc/User-Guide/Storage-folders.md +++ b/doc/User-Guide/Storage-folders.md @@ -2,19 +2,65 @@ - [1. Storage folders](#1-storage-folders) - [1.1 getStoragePath()](#11-getstoragepath) - [1.2 getSharedStoragePath()](#12-getsharedstoragepath) + - [1.3 Configuration](#13-configuration) # 1. Storage folders -There are two methods to obtain storage folders. The folders have different meaning and usage scenarios. + +Two storage paths are available. They serve different purposes and are suited to different use cases. ## 1.1 getStoragePath() -The files in this folder are considered temporary and instance specific. They exist only for as long as the instance exists. -Calling `app()->getStoragePath()` obtains the local storage folder `//app/src/storage`. +The local storage path is instance-specific. It is intended for temporary files that do not need to survive a restart or be shared with other instances. + +```php +$path = app()->getStoragePath(); +// e.g. /var/www/myapp/storage +``` + +The path resolves to `{basePath}/storage` where `basePath` is the root directory passed to the `Application` constructor. ## 1.2 getSharedStoragePath() -Files in this folder can be considered persistent as they are shared and accessible between all instances of the service. -Calling `app()->getSharedStoragePath()` obtains the configured path in the config file (`storage.shared`) and appends -the `envirnoment` and `application.code` to it to make it unique among all services. +The shared storage path is intended for persistent files that must be accessible across all instances of the application (e.g. in a load-balanced or multi-container environment). + +```php +$path = app()->getSharedStoragePath(); +// e.g. /mnt/shared/dev/myapp +``` + +The resolved path depends on the `storage.shared` config key: + +| `storage.shared` set? | Resolved path | +|-----------------------|---------------| +| Yes | `{storage.shared}/{environment}/{appCode}` | +| No (empty/absent) | Falls back to `getStoragePath()` | + +When the resolved path does not exist, the framework attempts to create it automatically. If creation fails, a warning is logged and the path remains as configured. + +## 1.3 Configuration + +Add a `storage` section to your `config-{env}.json` to enable shared storage: + +```json +"storage": { + "shared": "/mnt/shared" +} +``` + +With `appCode = myapp` and `environment = prod`, the resolved path becomes `/mnt/shared/prod/myapp`. + +The value supports environment variable expansion: + +```json +"storage": { + "shared": "${env:SHARED_STORAGE_PATH}" +} +``` + +Omit the key (or set it to an empty string) to use local storage only: -> **NOTE** If this folder is not found when the application is run() it is set to the same as `getStoragePath` to maintain a folder. +```json +"storage": { + "shared": "" +} +``` diff --git a/src/Application.php b/src/Application.php index 7746a87..ab8b7ed 100644 --- a/src/Application.php +++ b/src/Application.php @@ -62,7 +62,16 @@ class Application extends AbstractBaseClass implements ApplicationInterface protected string $storagePath; /** - * Path to shared storage + * Path to shared storage. + * + * This is either the path defined in `config('storage.shared')` or the local + * storage path if not set. The default path is `{$basePath}/storage/shared/{$environment}/{$appCode}` + * where `$environment` and `$appCode` are extracted from the config file. + * + * This allows multiple SPIN apps running on the same server/host to share the same storage folder if needed. + * + * Note: If the shared path does not exist, this will become the same as storage path. + * * @var mixed */ protected mixed $sharedStoragePath; diff --git a/src/ApplicationInterface.php b/src/ApplicationInterface.php index d23bf06..b58a460 100644 --- a/src/ApplicationInterface.php +++ b/src/ApplicationInterface.php @@ -140,9 +140,15 @@ public function getConfigPath(): string; public function getStoragePath(): string; /** - * Gets the full path to the configured shared storage path. - * If the config does not contain an entry for the shared storage, the result is the same - * as `getStoragePath()` + * Path to shared storage. + * + * This is either the path defined in `config('storage.shared')` or the local + * storage path if not set. The default path is `{$basePath}/storage/shared/{$environment}/{$appCode}` + * where `$environment` and `$appCode` are extracted from the config file. + * + * This allows multiple SPIN apps running on the same server/host to share the same storage folder if needed. + * + * Note: If the shared path does not exist, this will become the same as storage path. * * @return string The shared storage path */ From b36d6a4afebcc8a278105e9498b32f57448722eb Mon Sep 17 00:00:00 2001 From: Kim Sandell Date: Wed, 25 Mar 2026 06:45:39 +0100 Subject: [PATCH 3/3] Update version tagging format in release workflow --- .github/workflows/release.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7b43736..b541bea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,9 +45,9 @@ jobs: run: | git config user.name github-actions[bot] git config user.email github-actions[bot]@users.noreply.github.com - git tag -a "${{ steps.get_version.outputs.version }}" -m "Release version ${{ steps.get_version.outputs.version }}" - git push origin "${{ steps.get_version.outputs.version }}" - + git tag -a "v${{ steps.get_version.outputs.version }}" -m "Release version ${{ steps.get_version.outputs.version }}" + git push origin "v${{ steps.get_version.outputs.version }}" + - name: Extract changelog for version id: changelog if: steps.check_tag.outputs.exists == 'false' @@ -83,15 +83,16 @@ jobs: echo "changelog<> $GITHUB_OUTPUT echo "$CHANGELOG" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - + - name: Create Release if: steps.check_tag.outputs.exists == 'false' uses: softprops/action-gh-release@v2 with: - tag_name: ${{ steps.get_version.outputs.version }} - name: ${{ steps.get_version.outputs.version }} + tag_name: v${{ steps.get_version.outputs.version }} + name: v${{ steps.get_version.outputs.version }} body: | ${{ steps.changelog.outputs.changelog }} draft: false prerelease: false token: ${{ secrets.GITHUB_TOKEN }} +