From 461c186791df56818946126ec6b835738a1d3a9e Mon Sep 17 00:00:00 2001 From: Roland Sommer Date: Wed, 15 May 2024 09:59:08 +0200 Subject: [PATCH] Allow connection config via environment variable For the connection option environment variable handling is added. The connection string comes in handy if using the exporter via container deployment so that no credentials or otherwise sensible information is visible in the commandline or process list. Signed-off-by: Roland Sommer --- pgbouncer_exporter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pgbouncer_exporter.go b/pgbouncer_exporter.go index f4cbaa0..307d1d9 100644 --- a/pgbouncer_exporter.go +++ b/pgbouncer_exporter.go @@ -46,7 +46,7 @@ func main() { flag.AddFlags(kingpin.CommandLine, promlogConfig) var ( - connectionStringPointer = kingpin.Flag("pgBouncer.connectionString", "Connection string for accessing pgBouncer.").Default("postgres://postgres:@localhost:6543/pgbouncer?sslmode=disable").String() + connectionStringPointer = kingpin.Flag("pgBouncer.connectionString", "Connection string for accessing pgBouncer.").Default("postgres://postgres:@localhost:6543/pgbouncer?sslmode=disable").Envar("PGBOUNCER_EXPORTER_CONNECTION_STRING").String() metricsPath = kingpin.Flag("web.telemetry-path", "Path under which to expose metrics.").Default("/metrics").String() pidFilePath = kingpin.Flag("pgBouncer.pid-file", pidFileHelpText).Default("").String() )