mirror of
https://github.com/prometheus-community/postgres_exporter
synced 2025-04-23 23:45:28 +00:00
parent
9eff17a257
commit
3f905289a2
@ -1086,8 +1086,9 @@ func getDataSource() string {
|
|||||||
pass = os.Getenv("DATA_SOURCE_PASS")
|
pass = os.Getenv("DATA_SOURCE_PASS")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui := url.UserPassword(user, pass).String()
|
||||||
uri := os.Getenv("DATA_SOURCE_URI")
|
uri := os.Getenv("DATA_SOURCE_URI")
|
||||||
dsn = "postgresql://" + user + ":" + pass + "@" + uri
|
dsn = "postgresql://" + ui + "@" + uri
|
||||||
}
|
}
|
||||||
|
|
||||||
return dsn
|
return dsn
|
||||||
|
@ -105,7 +105,7 @@ func (s *FunctionalSuite) TestEnvironmentSettingWithSecretsFiles(c *C) {
|
|||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
defer UnsetEnvironment(c, "DATA_SOURCE_URI")
|
defer UnsetEnvironment(c, "DATA_SOURCE_URI")
|
||||||
|
|
||||||
var expected = "postgresql://custom_username:custom_password@localhost:5432/?sslmode=disable"
|
var expected = "postgresql://custom_username$&+,%2F%3A;=%3F%40:custom_password$&+,%2F%3A;=%3F%40@localhost:5432/?sslmode=disable"
|
||||||
|
|
||||||
dsn := getDataSource()
|
dsn := getDataSource()
|
||||||
if dsn != expected {
|
if dsn != expected {
|
||||||
|
@ -1 +1 @@
|
|||||||
custom_username
|
custom_username$&+,/:;=?@
|
||||||
|
@ -1 +1 @@
|
|||||||
custom_password
|
custom_password$&+,/:;=?@
|
||||||
|
Loading…
Reference in New Issue
Block a user