@@ -25,6 +25,7 @@ public static function bootstrapperBootstrapped(Application $app, string $bootst
25
25
{
26
26
(match ($ bootstrapper ) {
27
27
LoadConfiguration::class => function () use ($ app ) {
28
+ static ::configureDisks ($ app );
28
29
static ::configureUnpooledPostgresConnection ($ app );
29
30
static ::ensureMigrationsUseUnpooledConnection ($ app );
30
31
},
@@ -36,7 +37,38 @@ public static function bootstrapperBootstrapped(Application $app, string $bootst
36
37
}
37
38
38
39
/**
39
- * Adjust the database configuration for pooled Laravel Postgres.
40
+ * Configure the Laravel Cloud disks if applicable.
41
+ */
42
+ public static function configureDisks (Application $ app ): void
43
+ {
44
+ if (! isset ($ _SERVER ['LARAVEL_CLOUD_DISK_CONFIG ' ])) {
45
+ return ;
46
+ }
47
+
48
+ $ disks = json_decode ($ _SERVER ['LARAVEL_CLOUD_DISK_CONFIG ' ], true );
49
+
50
+ foreach ($ disks as $ disk ) {
51
+ $ app ['config ' ]->set ('filesystems.disks. ' .$ disk ['disk ' ], [
52
+ 'driver ' => 's3 ' ,
53
+ 'key ' => $ disk ['access_key_id ' ],
54
+ 'secret ' => $ disk ['access_key_secret ' ],
55
+ 'bucket ' => $ disk ['bucket ' ],
56
+ 'url ' => $ disk ['url ' ],
57
+ 'endpoint ' => $ disk ['endpoint ' ],
58
+ 'region ' => 'auto ' ,
59
+ 'use_path_style_endpoint ' => false ,
60
+ 'throw ' => false ,
61
+ 'report ' => false ,
62
+ ]);
63
+
64
+ if ($ disk ['is_default ' ] ?? false ) {
65
+ $ app ['config ' ]->set ('filesystems.default ' , $ disk ['disk ' ]);
66
+ }
67
+ }
68
+ }
69
+
70
+ /**
71
+ * Configure the unpooled Laravel Postgres connection if applicable.
40
72
*/
41
73
public static function configureUnpooledPostgresConnection (Application $ app ): void
42
74
{
0 commit comments