2
0

ParseEnvLibpq extracts PGAPPNAME

This commit is contained in:
Jack Christensen
2015-10-16 16:12:25 -05:00
parent 829d61ce40
commit ec8f6259e6
2 changed files with 32 additions and 1 deletions
+6
View File
@@ -442,6 +442,7 @@ func ParseDSN(s string) (ConnConfig, error) {
// PGUSER
// PGPASSWORD
// PGSSLMODE
// PGAPPNAME
//
// Important TLS Security Notes:
// ParseEnvLibpq tries to match libpq behavior with regard to PGSSLMODE. This
@@ -484,6 +485,11 @@ func ParseEnvLibpq() (ConnConfig, error) {
return cc, err
}
cc.RuntimeParams = make(map[string]string)
if appname := os.Getenv("PGAPPNAME"); appname != "" {
cc.RuntimeParams["application_name"] = appname
}
return cc, nil
}