fix(postgres): no password in connection string when empty (#356)

This commit is contained in:
Stefan Benz 2020-07-07 11:31:12 +02:00 committed by GitHub
parent 65b17a83fb
commit 9c277e2efb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,10 +37,13 @@ func (s *SQL) connectionString() string {
"host=" + s.Host, "host=" + s.Host,
"port=" + s.Port, "port=" + s.Port,
"user=" + s.User, "user=" + s.User,
"password=" + s.Password,
"dbname=" + s.Database, "dbname=" + s.Database,
"sslmode=" + s.SSL.Mode, "sslmode=" + s.SSL.Mode,
} }
if s.Password != "" {
fields = append(fields, "password="+s.Password)
}
if s.SSL.Mode != sslDisabledMode { if s.SSL.Mode != sslDisabledMode {
fields = append(fields, []string{ fields = append(fields, []string{
"ssl=true", "ssl=true",