Add --datasource.* CLI flags to replace DATA_SOURCE_* env vars

Open
#1,372 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
go, postgresql
Domain
cli, databases

Research direction

Start in exporter/datasource.go by tracing GetDataSources() and how it currently reads the DATA_SOURCE_* environment variables. Locate the project's CLI flag registration path, add the seven listed datasource options with equivalent configuration behavior, and verify that each flag can provide the corresponding setting without relying on its environment variable.

Written by the indexing model from the issue text.

Description

go help wanted

Part of #1371.

Summary

GetDataSources() in exporter/datasource.go currently reads the Postgres connection config only from env vars, with no CLI flag path. Add flags that provide the same configuration options, so the env vars have something to deprecate in favor of.

New flags

  • --datasource.dsn (replaces DATA_SOURCE_NAME)
  • --datasource.uri (replaces DATA_SOURCE_URI)
  • --datasource.uri-file (replaces DATA_SOURCE_URI_FILE)
  • --datasource.user (replaces DATA_SOURCE_USER)
  • --datasource.user-file (replaces DATA_SOURCE_USER_FILE)
  • --datasource.pass (replaces DATA_SOURCE_PASS)
  • --datasource.pass-file (replaces DATA_SOURCE_PASS_FILE)
Dominant language
Go
Stars
3.6k
Forks
835
Avg merge
2d 4h
Merged PRs (30d)
10

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from prometheus-community/postgres_exporter

All issues in prometheus-community/postgres_exporter

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.