Skip to content

Commit

Permalink
BugFix: Fixed dbname parameter - now it correctly works with PostgreS…
Browse files Browse the repository at this point in the history
…QL connection string in URI format postgresql:///
  • Loading branch information
gracingpro committed Jan 30, 2024
1 parent e119bf8 commit 704f2df
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/db/postgres/pgdump/pgdump.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,11 @@ type Options struct {
}

func (o *Options) GetPgDSN() (string, error) {
//return "host=localhost port=5432 user=postgres dbname=postgres", nil
if strings.Contains(o.DbName, "=") {
// URI or Standard format
if strings.HasPrefix(o.DbName, "postgresql://") || strings.Contains(o.DbName, "=") {
return o.DbName, nil
}

return fmt.Sprintf("host=%s port=%d user=%s dbname=%s", o.Host, o.Port, o.UserName, o.DbName), nil
}

Expand Down

0 comments on commit 704f2df

Please sign in to comment.