2
0

Support of PGTARGETSESSIONATTRS ENV variable

Signed-off-by: Artemiy Ryabinkov <getlag@ya.ru>
This commit is contained in:
Artemiy Ryabinkov
2019-07-11 20:56:44 +03:00
parent 18189fafd5
commit 39cbdf789d
2 changed files with 7 additions and 2 deletions
+7 -1
View File
@@ -1016,6 +1016,7 @@ func ParseURI(uri string) (ConnConfig, error) {
if cp.Password == "" {
pgpass(&cp)
}
return cp, nil
}
@@ -1181,7 +1182,7 @@ func ParseConnectionString(s string) (ConnConfig, error) {
// PGSSLROOTCERT
// PGAPPNAME
// PGCONNECT_TIMEOUT
// TODO: PGTARGETSESSIONATTRS support
// PGTARGETSESSIONATTRS
// @see: https://www.postgresql.org/docs/10/libpq-envars.html
//
// Important TLS Security Notes:
@@ -1228,6 +1229,11 @@ func ParseEnvLibpq() (ConnConfig, error) {
}
}
cc.TargetSessionAttrs = TargetSessionType(os.Getenv("PGTARGETSESSIONATTRS"))
if err := cc.TargetSessionAttrs.isValid(); err != nil {
return cc, err
}
tlsArgs := configTLSArgs{
sslMode: os.Getenv("PGSSLMODE"),
sslKey: os.Getenv("PGSSLKEY"),
-1
View File
@@ -57,7 +57,6 @@ func parsepgpass(line, cfgHost, cfgPort, cfgDatabase, cfgUsername string) *strin
return &parts[4]
}
// TODO: Multi-host support
func pgpass(cfg *ConnConfig) (found bool) {
passfile := os.Getenv("PGPASSFILE")
if passfile == "" {