Skip to content

Commit

Permalink
NEOS-1100 add support for client certificates to postgres (#2019)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickzelei authored May 24, 2024
1 parent e5b89c6 commit c162b67
Show file tree
Hide file tree
Showing 16 changed files with 1,133 additions and 362 deletions.
777 changes: 442 additions & 335 deletions backend/gen/go/protos/mgmt/v1alpha1/connection.pb.go

Large diffs are not rendered by default.

141 changes: 141 additions & 0 deletions backend/gen/go/protos/mgmt/v1alpha1/connection.pb.validate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion backend/pkg/sqlconnect/pgpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package sqlconnect

import (
context "context"
"fmt"
"log/slog"

"github.com/jackc/pgx/v5/pgxpool"
Expand Down Expand Up @@ -46,14 +47,15 @@ func (s *PgPool) Open(ctx context.Context) (pg_queries.DBTX, error) {
return nil, err
}
<-ready

_, localport := s.details.Tunnel.GetLocalHostPort()
newPort := int32(localport)
s.details.GeneralDbConnectConfig.Port = newPort
dsn := s.details.GeneralDbConnectConfig.String()

config, err := pgxpool.ParseConfig(dsn)
if err != nil {
return nil, err
return nil, fmt.Errorf("unable to parse dsn into pg config: %w", err)
}

// set max number of connections.
Expand Down
Loading

0 comments on commit c162b67

Please sign in to comment.