From 38be038e34ce26578bbf0750b63d8c4a66ab7f82 Mon Sep 17 00:00:00 2001 From: taylorotwell <463230+taylorotwell@users.noreply.github.com> Date: Thu, 30 Jan 2025 10:24:32 +0000 Subject: [PATCH 1/3] Update CHANGELOG --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 139730120321..a7b694ff239f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Release Notes for 11.x -## [Unreleased](https://github.com/laravel/framework/compare/v11.41.1...11.x) +## [Unreleased](https://github.com/laravel/framework/compare/v11.41.2...11.x) + +## [v11.41.2](https://github.com/laravel/framework/compare/v11.41.1...v11.41.2) - 2025-01-30 ## [v11.41.1](https://github.com/laravel/framework/compare/v11.41.0...v11.41.1) - 2025-01-30 From e615f087702745a6508b4f9e8e0b8815efb3ca54 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 30 Jan 2025 14:23:06 +0100 Subject: [PATCH 2/3] configure disks --- src/Illuminate/Foundation/Cloud.php | 34 +++++++++++++++++++++- tests/Integration/Foundation/CloudTest.php | 33 +++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Cloud.php b/src/Illuminate/Foundation/Cloud.php index d954bf34b00f..2bd1dffafc31 100644 --- a/src/Illuminate/Foundation/Cloud.php +++ b/src/Illuminate/Foundation/Cloud.php @@ -25,6 +25,7 @@ public static function bootstrapperBootstrapped(Application $app, string $bootst { (match ($bootstrapper) { LoadConfiguration::class => function () use ($app) { + static::configureDisks($app); static::configureUnpooledPostgresConnection($app); static::ensureMigrationsUseUnpooledConnection($app); }, @@ -36,7 +37,38 @@ public static function bootstrapperBootstrapped(Application $app, string $bootst } /** - * Adjust the database configuration for pooled Laravel Postgres. + * Configure the Laravel Cloud disks if applicable. + */ + public static function configureDisks(Application $app): void + { + if (! isset($_SERVER['LARAVEL_CLOUD_DISK_CONFIG'])) { + return; + } + + $disks = json_decode($_SERVER['LARAVEL_CLOUD_DISK_CONFIG'], true); + + foreach ($disks as $disk) { + $app['config']->set('filesystems.disks.'.$disk['disk'], [ + 'driver' => 's3', + 'key' => $disk['access_key_id'], + 'secret' => $disk['access_key_secret'], + 'bucket' => $disk['bucket'], + 'url' => $disk['url'], + 'endpoint' => $disk['endpoint'], + 'region' => 'auto', + 'use_path_style_endpoint' => false, + 'throw' => false, + 'report' => false, + ]); + + if ($disk['is_default'] ?? false) { + $app['config']->set('filesystems.default', $disk['disk']); + } + } + } + + /** + * Configure the unpooled Laravel Postgres connection if applicable. */ public static function configureUnpooledPostgresConnection(Application $app): void { diff --git a/tests/Integration/Foundation/CloudTest.php b/tests/Integration/Foundation/CloudTest.php index 99ff0e75347a..f2711fd85e2f 100644 --- a/tests/Integration/Foundation/CloudTest.php +++ b/tests/Integration/Foundation/CloudTest.php @@ -23,4 +23,37 @@ public function test_it_can_resolve_core_container_aliases() 'password' => 'test-password', ], $this->app['config']->get('database.connections.pgsql-unpooled')); } + + public function test_it_can_configure_disks() + { + $_SERVER['LARAVEL_CLOUD_DISK_CONFIG'] = json_encode( + [ + [ + 'disk' => 'test-disk', + 'access_key_id' => 'test-access-key-id', + 'access_key_secret' => 'test-access-key-secret', + 'bucket' => 'test-bucket', + 'url' => 'test-url', + 'endpoint' => 'test-endpoint', + 'is_default' => false, + ], + [ + 'disk' => 'test-disk-2', + 'access_key_id' => 'test-access-key-id-2', + 'access_key_secret' => 'test-access-key-secret-2', + 'bucket' => 'test-bucket-2', + 'url' => 'test-url-2', + 'endpoint' => 'test-endpoint-2', + 'is_default' => true, + ], + ] + ); + + Cloud::configureDisks($this->app); + + $this->assertEquals('test-disk-2', $this->app['config']->get('filesystems.default')); + $this->assertEquals('test-access-key-id', $this->app['config']->get('filesystems.disks.test-disk.key')); + + unset($_SERVER['LARAVEL_CLOUD_DISK_CONFIG']); + } } From 3ef433d5865f30a19b6b1be247586068399b59cc Mon Sep 17 00:00:00 2001 From: taylorotwell <463230+taylorotwell@users.noreply.github.com> Date: Thu, 30 Jan 2025 13:25:22 +0000 Subject: [PATCH 3/3] Update version to v11.41.3 --- src/Illuminate/Foundation/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index a44f959c73ec..61197e86d3d5 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -45,7 +45,7 @@ class Application extends Container implements ApplicationContract, CachesConfig * * @var string */ - const VERSION = '11.41.2'; + const VERSION = '11.41.3'; /** * The base path for the Laravel installation.