8000 Handle pooled Postgres connections for Laravel Cloud by taylorotwell · Pull Request #54346 · laravel/framework · GitHub
[go: up one dir, main page]

Skip to content

Handle pooled Postgres connections for Laravel Cloud #54346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add test
  • Loading branch information
taylorotwell committed Jan 30, 2025
commit a0a6a40de13f8255e50f92c93195d07f52ae6779
6 changes: 3 additions & 3 deletions src/Illuminate/Foundation/Cloud.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static function bootstrapperBootstrapped(Application $app, string $bootst
/**
* Adjust the database configuration for pooled Laravel Postgres.
*/
protected static function configureUnpooledPostgresConnection(Application $app): void
public static function configureUnpooledPostgresConnection(Application $app): void
{
$host = $app['config']->get('database.connections.pgsql.host', '');

Expand All @@ -55,7 +55,7 @@ protected static function configureUnpooledPostgresConnection(Application $app):
/**
* Ensure that migrations use the unpooled Postgres connection if applicable.
*/
protected static function ensureMigrationsUseUnpooledConnection(Application $app): void
public static function ensureMigrationsUseUnpooledConnection(Application $app): void
{
if (! is_array($app['config']->get('database.connections.pgsql-unpooled'))) {
return;
Expand All @@ -73,7 +73,7 @@ protected static function ensureMigrationsUseUnpooledConnection(Application $app
/**
* Configure the Laravel Cloud log channels.
*/
protected static function configureCloudLogging(Application $app): void
public static function configureCloudLogging(Application $app): void
{
$app['config']->set('logging.channels.stderr.formatter_with', [
'includeStacktraces' => true,
Expand Down
26 changes: 26 additions & 0 deletions tests/Integration/Foundation/CloudTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace Illuminate\Tests\Integration\Foundation;

use Illuminate\Foundation\Cloud;
use Orchestra\Testbench\TestCase;

class CloudTest extends TestCase
{
public function test_it_can_resolve_core_container_aliases()
{
$this->app['config']->set('database.connections.pgsql', [
'host' => 'test-pooler.pg.laravel.cloud',
'username' => 'test-username',
'password' => 'test-password',
]);

Cloud::configureUnpooledPostgresConnection($this->app);

$this->assertEquals([
'host' => 'test.pg.laravel.cloud',
'username' => 'test-username',
'password' => 'test-password',
], $this->app['config']->get('database.connections.pgsql-unpooled'));
}
}
0