Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

Commit 4d5b19c

Browse files
committed
Skip setting on empty values
1 parent afdd4df commit 4d5b19c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/LaravelDbUriServiceProvider.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,15 @@ public function register()
5050
$driver = $driver === 'default' ? config('database.default') : $driver;
5151

5252
// Get the DATABASE_URL env value or skip out
53-
if(empty($url = env($connection_key))) return;
53+
if(empty($url = env($connection_key))) continue;
5454

5555
// Try to parse it
5656
if(!$components = parse_url($url)) throw new \Exception('Database URL may be malformed.');
5757

5858
// Set each config
5959
foreach($this->config_map as $component_key => $config_key) {
60+
// Skip setting when no value
61+
if(empty($components[$component_key])) continue;
6062
config(["database.connections.{$driver}.{$config_key}" => $this->clean($component_key, $components[$component_key])]);
6163
}
6264
}

0 commit comments

Comments
 (0)