MCPcopy Create free account
hub / github.com/bytebase/bytebase / getRDSConnectionConfig

Function getRDSConnectionConfig

backend/plugin/db/pg/pg.go:254–270  ·  view source on GitHub ↗

getRDSConnectionConfig returns connection config for AWS RDS. https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.Connecting.Go.html

(ctx context.Context, conf db.ConnectionConfig)

Source from the content-addressed store, hash-verified

252//
253// https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.Connecting.Go.html
254func getRDSConnectionConfig(ctx context.Context, conf db.ConnectionConfig) (*pgx.ConnConfig, error) {
255 password, err := getRDSConnectionPassword(ctx, conf)
256 if err != nil {
257 return nil, err
258 }
259
260 dsn := fmt.Sprintf("host=%s port=%s user=%s password=%s",
261 conf.DataSource.Host, conf.DataSource.Port, conf.DataSource.Username, password,
262 )
263 config, err := pgx.ParseConfig(dsn)
264 if err != nil {
265 return nil, err
266 }
267 config.DefaultQueryExecMode = pgx.QueryExecModeExec
268 config.StatementCacheCapacity = 0
269 return config, nil
270}
271
272// getCloudSQLConnectionConfig returns config for Cloud SQL connector.
273// refs:

Callers 1

OpenMethod · 0.85

Calls 1

getRDSConnectionPasswordFunction · 0.85

Tested by

no test coverage detected