1
0
mirror of https://github.com/prometheus-community/postgres_exporter.git synced 2026-10-23 12:08:57 +03:00

2 Commits

Author SHA1 Message Date
Nicolas Takashi
f10a723513 Add --datasource.* CLI flags to replace DATA_SOURCE_* env vars (#1376)
Closes #1372. Part of #1371.

Adds CLI flags for the parts of the Postgres connection config that
aren't secrets: --datasource.uri (replaces DATA_SOURCE_URI), plus
--datasource.uri-file, --datasource.user-file and --datasource.pass-file
(replacing the *_FILE env vars) for values sourced from mounted files.

The user and password values themselves stay env-var only
(DATA_SOURCE_USER / DATA_SOURCE_PASS), since CLI flags are readable via
/proc and the Kubernetes API and would leak the secret itself. The
*-file flags carry only a path, the same pattern Prometheus uses for
password_file, so no secret ever reaches the command line.

Flag and env var reading now lives in cmd/postgres_exporter rather than
the exporter package, which we're trying to shrink. exporter.GetDataSources
stays for embedders, marked deprecated with a migration note, and will be
removed in v0.22.0.

The four env vars that gained a flag are deprecated: the exporter warns
at startup when one is set, the CHANGELOG maps each to its replacement,
and the docs now configure the exporter by flag.

Each flag falls back to its env var when unset, so behavior is unchanged
when only env vars are set. Precedence is unchanged: DATA_SOURCE_NAME
wins over everything, *_FILE wins over the plain value.

Signed-off-by: Nicolas Takashi <nicolas.takashi@dash0.com>
Co-authored-by: Arthur Silva Sens <arthursens2005@gmail.com>
2026-10-15 17:06:27 -04:00
Joe Adams
667a402226 Create user facing documentation (#1361)
* Create user facing documentation

Create a docs/ directory with user facing documentation. This covers getting started, running with docker, specifying secrets, configuration, and database permissions. This is all focused on the perspective of a user or someone deploying the exporter.

Signed-off-by: Joe Adams <github@joeadams.io>

* Update getting started to show multiple options

Clean up duplication on docker commands. Make the docs README more useful as a standalone page.

Signed-off-by: Joe Adams <github@joeadams.io>

* Update configuration docs

Add more details on each flag and collector to help the user understand the purpose.

Signed-off-by: Joe Adams <github@joeadams.io>

* Add frontmatter

Signed-off-by: Joe Adams <github@joeadams.io>

* Review feedback

Remove deprecated option doc and /-/reload endpoint (unimplemented).

Signed-off-by: Joe Adams <github@joeadams.io>

* Add 2 new flags in user docs configuration

Signed-off-by: Joe Adams <github@joeadams.io>

* Fix docs link

Signed-off-by: Joe Adams <github@joeadams.io>

* Fix correctness in docs

Signed-off-by: Joe Adams <github@joeadams.io>

---------

Signed-off-by: Joe Adams <github@joeadams.io>
2026-09-22 22:15:45 -04:00