Skip to content

Commit

Permalink
Ignore environment variables we cant/wont handle.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdevan committed Mar 7, 2018
1 parent 0fc7f0b commit f7d944f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cmd/pgmetrics/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,21 @@ Usage:
PGSSLKEY path to secret key for client SSL certificate
PGSSLROOTCERT path to SSL root CA
PGCONNECT_TIMEOUT connection timeout in seconds
Also, the following libpq-related environment variarables are not
required/used by pgmetrics and are IGNORED:
PGHOSTADDR, PGSERVICE, PGSERVICEFILE, PGREALM, PGREQUIRESSL,
PGSSLCRL, PGREQUIREPEER, PGKRBSRVNAME, PGGSSLIB, PGSYSCONFDIR,
PGLOCALEDIR
`

var version string // set during build
var ignoreEnvs = []string{
"PGHOSTADDR", "PGSERVICE", "PGSERVICEFILE", "PGREALM", "PGREQUIRESSL",
"PGSSLCRL", "PGREQUIREPEER", "PGKRBSRVNAME", "PGGSSLIB", "PGSYSCONFDIR",
"PGLOCALEDIR",
}

type options struct {
// general
Expand Down Expand Up @@ -285,6 +297,10 @@ func process(result *pgmetrics.Model, o options, args []string) {
}

func main() {
for _, e := range ignoreEnvs {
os.Unsetenv(e)
}

var o options
o.defaults()
args := o.parse()
Expand Down

0 comments on commit f7d944f

Please sign in to comment.