Skip to content

Commit a6c21c0

Browse files
committed
Revert "wip"
This reverts commit 485d473.
1 parent 485d473 commit a6c21c0

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

packages/database/src/Config/PostgresConfig.php

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@
1212
final class PostgresConfig implements DatabaseConfig
1313
{
1414
public string $dsn {
15-
get => $this->buildDsn();
15+
get => sprintf(
16+
'pgsql:host=%s;port=%s;dbname=%s;user=%s;password=%s',
17+
$this->host,
18+
$this->port,
19+
$this->database,
20+
$this->username,
21+
$this->password,
22+
);
1623
}
1724

1825
public DatabaseDialect $dialect {
@@ -27,28 +34,10 @@ public function __construct(
2734
#[SensitiveParameter]
2835
public string $username = 'postgres',
2936
#[SensitiveParameter]
30-
public ?string $password = null,
37+
public string $password = '',
3138
#[SensitiveParameter]
3239
public string $database = 'app',
3340
public NamingStrategy $namingStrategy = new PluralizedSnakeCaseStrategy(),
3441
public null|string|UnitEnum $tag = null,
3542
) {}
36-
37-
private function buildDsn(): string
38-
{
39-
$dsn = sprintf(
40-
'pgsql:host=%s;port=%s;dbname=%s;user=%s',
41-
$this->host,
42-
$this->port,
43-
$this->database,
44-
$this->username,
45-
$this->password,
46-
);
47-
48-
if ($this->password !== null) {
49-
$dsn .= ';password=%s' . $this->password;
50-
}
51-
52-
return $dsn;
53-
}
5443
}

0 commit comments

Comments
 (0)