Skip to content

Commit 3ec6860

Browse files
committed
keep default user as postgres
1 parent 380197e commit 3ec6860

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/detectors/jdbc/postgres.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,13 @@ func ParsePostgres(ctx logContext.Context, subname string) (jdbc, error) {
126126

127127
func BuildPostgresConnectionString(host string, user string, password string, dbName string, params map[string]string, includeDbName bool) string {
128128
data := map[string]string{
129-
"host": host,
130-
"user": user,
129+
// default user
130+
"user": "postgres",
131131
"password": password,
132+
"host": host,
133+
}
134+
if user != "" {
135+
data["user"] = user
132136
}
133137
if h, p, found := strings.Cut(host, ":"); found {
134138
data["host"] = h

0 commit comments

Comments
 (0)