Commit 7b2d0359 authored by OptimismBot's avatar OptimismBot Committed by GitHub

Merge pull request #7350 from...

Merge pull request #7350 from ethereum-optimism/09-22-fix_indexer_Don_t_set_port_if_there_is_no_port

fix(indexer): Don't set port if there is no port
parents a17ce9b7 caef94c6
...@@ -38,7 +38,10 @@ type DB struct { ...@@ -38,7 +38,10 @@ type DB struct {
func NewDB(dbConfig config.DBConfig) (*DB, error) { func NewDB(dbConfig config.DBConfig) (*DB, error) {
retryStrategy := &retry.ExponentialStrategy{Min: 1000, Max: 20_000, MaxJitter: 250} retryStrategy := &retry.ExponentialStrategy{Min: 1000, Max: 20_000, MaxJitter: 250}
dsn := fmt.Sprintf("host=%s port=%d dbname=%s sslmode=disable", dbConfig.Host, dbConfig.Port, dbConfig.Name) dsn := fmt.Sprintf("host=%s dbname=%s sslmode=disable", dbConfig.Host, dbConfig.Name)
if dbConfig.Port != 0 {
dsn += fmt.Sprintf(" port=%d", dbConfig.Port)
}
if dbConfig.User != "" { if dbConfig.User != "" {
dsn += fmt.Sprintf(" user=%s", dbConfig.User) dsn += fmt.Sprintf(" user=%s", dbConfig.User)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment