From 9c277e2efbc1fdd7b9f165271c55cc1ccced7944 Mon Sep 17 00:00:00 2001 From: Stefan Benz <46600784+stebenz@users.noreply.github.com> Date: Tue, 7 Jul 2020 11:31:12 +0200 Subject: [PATCH] fix(postgres): no password in connection string when empty (#356) --- internal/config/types/sql.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/config/types/sql.go b/internal/config/types/sql.go index de98cc21eb..091787bdb1 100644 --- a/internal/config/types/sql.go +++ b/internal/config/types/sql.go @@ -37,10 +37,13 @@ func (s *SQL) connectionString() string { "host=" + s.Host, "port=" + s.Port, "user=" + s.User, - "password=" + s.Password, "dbname=" + s.Database, "sslmode=" + s.SSL.Mode, } + if s.Password != "" { + fields = append(fields, "password="+s.Password) + } + if s.SSL.Mode != sslDisabledMode { fields = append(fields, []string{ "ssl=true",