修复:支持生产私有上游端点覆盖
This commit is contained in:
parent
9a65836e3f
commit
e92ccfa376
@ -65,7 +65,6 @@ class UpstreamSourceRegistry
|
||||
|
||||
private function usesLocalConfiguration(): bool
|
||||
{
|
||||
return app()->environment(['local', 'development', 'testing'])
|
||||
&& (bool) config('upstreams.local_configuration.enabled', false);
|
||||
return (bool) config('upstreams.local_configuration.enabled', false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,6 +132,33 @@ class UpstreamDatabasesTest extends FeatureTestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function test_private_override_is_honored_when_explicitly_enabled_in_production(): void
|
||||
{
|
||||
$connection = $this->connection('shared-secret');
|
||||
$connection->update(['source_key' => 'jiansun']);
|
||||
$this->app->detectEnvironment(fn () => 'production');
|
||||
|
||||
try {
|
||||
config([
|
||||
'upstreams.local_configuration.enabled' => true,
|
||||
'jiansun.connection.host' => 'private-tunnel.test',
|
||||
'jiansun.connection.password' => 'private-secret',
|
||||
]);
|
||||
$sources = new UpstreamSourceRegistry(new UpstreamStoredConfiguration());
|
||||
|
||||
$this->assertSame(
|
||||
'private-tunnel.test',
|
||||
$sources->value('jiansun', 'connection.host')
|
||||
);
|
||||
$this->assertSame(
|
||||
'private-secret',
|
||||
$sources->value('jiansun', 'connection.password')
|
||||
);
|
||||
} finally {
|
||||
$this->app->detectEnvironment(fn () => 'testing');
|
||||
}
|
||||
}
|
||||
|
||||
public function test_shared_password_is_available_with_a_different_app_key(): void
|
||||
{
|
||||
$connection = $this->connection('shared-secret');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user