Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
chilagrow committed Feb 19, 2024
1 parent daba28a commit 5a8014e
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions internal/backends/postgresql/metadata/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"context"
"fmt"
"hash/fnv"
"net/url"
"regexp"
"slices"
"sort"
Expand Down Expand Up @@ -101,23 +100,6 @@ func NewRegistry(u string, l *zap.Logger, sp *state.Provider) (*Registry, error)
l: l,
}

baseURI, err := url.Parse(u)
if err != nil {
return nil, lazyerrors.Error(err)
}

username := baseURI.User.Username()
pwd, _ := baseURI.User.Password()

c := conninfo.New()
c.SetAuth(username, pwd)
ctx := conninfo.Ctx(context.Background(), c)

_, err = r.getPool(ctx)
if err != nil {
return nil, lazyerrors.Error(err)
}

return r, nil
}

Expand All @@ -143,7 +125,11 @@ func (r *Registry) getPool(ctx context.Context) (*pgxpool.Pool, error) {

if connInfo.BypassBackendAuth() {
if p = r.p.GetAny(); p == nil {
return nil, lazyerrors.New("no connection pool")
var err error
// pass no authentication info to use credentials from the base URI
if p, err = r.p.Get("", ""); err != nil {
return nil, lazyerrors.Error(err)

Check warning on line 131 in internal/backends/postgresql/metadata/registry.go

View check run for this annotation

Codecov / codecov/patch

internal/backends/postgresql/metadata/registry.go#L131

Added line #L131 was not covered by tests
}
}
} else {
username, password := connInfo.Auth()
Expand Down

0 comments on commit 5a8014e

Please sign in to comment.