File tree Expand file tree Collapse file tree 1 file changed +9
-20
lines changed
packages/database/src/Config Expand file tree Collapse file tree 1 file changed +9
-20
lines changed Original file line number Diff line number Diff line change 1212final 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}
You can’t perform that action at this time.
0 commit comments