@@ -51,13 +51,13 @@ func (*PgFactory) Type() string {
51
51
}
52
52
53
53
func decodeTLSParam (tlsparm string ) string {
54
- switch tlsparm {
55
- case "VerifyCA " :
54
+ switch strings . ToLower ( tlsparm ) {
55
+ case "verifyca" , "one-way " :
56
56
return "verify-ca"
57
- case "VerifyFull " :
57
+ case "verifyfull" , "two-way " :
58
58
return "verify-full"
59
59
default :
60
- return ""
60
+ return tlsparm
61
61
}
62
62
}
63
63
@@ -87,10 +87,6 @@ func NewDB(settings map[string]interface{}) (*sql.DB, error) {
87
87
if cUser == "" {
88
88
return nil , errors .New ("Required Parameter User is missing" )
89
89
}
90
- cPassword := s .Password
91
- if cPassword == "" {
92
- return nil , errors .New ("Required Parameter Password is missing" )
93
- }
94
90
95
91
cMaxOpenConn := s .MaxOpenConnections
96
92
if cMaxOpenConn == 0 {
@@ -143,12 +139,12 @@ func NewDB(settings map[string]interface{}) (*sql.DB, error) {
143
139
var conninfo string
144
140
if cTLSConfig == false {
145
141
logCache .Debugf ("Login attempting plain connection" )
146
- conninfo = fmt .Sprintf ("host=%s port=%d user=%s password=%s dbname=%s sslmode=disable connect_timeout=%d " , cHost , cPort , cUser , cPassword , cDbName , cConnTimeout )
142
+ 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 )
147
143
} else {
148
144
logCache .Debugf ("Login attempting SSL connection" )
149
145
cTLSMode := s .TLSMode
150
146
conninfo = fmt .Sprintf ("host=%s port=%d user=%s password=%s dbname=%s sslmode=%s connect_timeout=%d " ,
151
- cHost , cPort , cUser , cPassword , cDbName , decodeTLSParam (cTLSMode ), cConnTimeout )
147
+ cHost , cPort , cUser , s . Password , cDbName , decodeTLSParam (cTLSMode ), cConnTimeout )
152
148
//create temp file
153
149
pwd , err := os .Getwd ()
154
150
if err != nil {
0 commit comments