Add a reasonable application_name for PostgreSQL (#11048)
Signed-off-by: Alexander Sosna <alexander@sosna.de>
This commit is contained in:
parent
ee53fc5afb
commit
d4b206ed4b
|
@ -128,13 +128,19 @@ func (c *SQLConnectionProducer) Connection(ctx context.Context) (interface{}, er
|
|||
// Otherwise, attempt to make connection
|
||||
conn := c.ConnectionURL
|
||||
|
||||
// Ensure timezone is set to UTC for all the connections
|
||||
// PostgreSQL specific settings
|
||||
if strings.HasPrefix(conn, "postgres://") || strings.HasPrefix(conn, "postgresql://") {
|
||||
// Ensure timezone is set to UTC for all the connections
|
||||
if strings.Contains(conn, "?") {
|
||||
conn += "&timezone=UTC"
|
||||
} else {
|
||||
conn += "?timezone=UTC"
|
||||
}
|
||||
|
||||
// Ensure a reasonable application_name is set
|
||||
if !strings.Contains(conn, "application_name") {
|
||||
conn += "&application_name=vault"
|
||||
}
|
||||
}
|
||||
|
||||
var err error
|
||||
|
|
|
@ -128,13 +128,19 @@ func (c *SQLConnectionProducer) Connection(ctx context.Context) (interface{}, er
|
|||
// Otherwise, attempt to make connection
|
||||
conn := c.ConnectionURL
|
||||
|
||||
// Ensure timezone is set to UTC for all the connections
|
||||
// PostgreSQL specific settings
|
||||
if strings.HasPrefix(conn, "postgres://") || strings.HasPrefix(conn, "postgresql://") {
|
||||
// Ensure timezone is set to UTC for all the connections
|
||||
if strings.Contains(conn, "?") {
|
||||
conn += "&timezone=UTC"
|
||||
} else {
|
||||
conn += "?timezone=UTC"
|
||||
}
|
||||
|
||||
// Ensure a reasonable application_name is set
|
||||
if !strings.Contains(conn, "application_name") {
|
||||
conn += "&application_name=vault"
|
||||
}
|
||||
}
|
||||
|
||||
var err error
|
||||
|
|
Loading…
Reference in New Issue