Skip to content

Commit

Permalink
make db password optional for two way ssl
Browse files Browse the repository at this point in the history
  • Loading branch information
abhijitWakchaure committed Dec 14, 2022
1 parent 43c7638 commit e4837e8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions flow-state/store/postgres/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ func NewDB(settings map[string]interface{}) (*sql.DB, error) {
if cUser == "" {
return nil, errors.New("Required Parameter User is missing")
}
cPassword := s.Password
if cPassword == "" {
return nil, errors.New("Required Parameter Password is missing")
}

cMaxOpenConn := s.MaxOpenConnections
if cMaxOpenConn == 0 {
Expand Down Expand Up @@ -143,12 +139,12 @@ func NewDB(settings map[string]interface{}) (*sql.DB, error) {
var conninfo string
if cTLSConfig == false {
logCache.Debugf("Login attempting plain connection")
conninfo = fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=disable connect_timeout=%d ", cHost, cPort, cUser, cPassword, cDbName, cConnTimeout)
conninfo = fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=disable connect_timeout=%d ", cHost, cPort, cUser, s.Password, cDbName, cConnTimeout)
} else {
logCache.Debugf("Login attempting SSL connection")
cTLSMode := s.TLSMode
conninfo = fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=%s connect_timeout=%d ",
cHost, cPort, cUser, cPassword, cDbName, decodeTLSParam(cTLSMode), cConnTimeout)
cHost, cPort, cUser, s.Password, cDbName, decodeTLSParam(cTLSMode), cConnTimeout)
//create temp file
pwd, err := os.Getwd()
if err != nil {
Expand Down

0 comments on commit e4837e8

Please sign in to comment.