mongodb_exporter icon indicating copy to clipboard operation
mongodb_exporter copied to clipboard

`--mongodb.uri` vs `MONGODB_URL`

Open arvenil opened this issue 7 years ago • 0 comments

func mongodbDefaultURI() string {
	if u := os.Getenv("MONGODB_URL"); u != "" {
		return u
	}
	return "mongodb://localhost:27017"
}

var (
	mongodbURIFlag = flag.String("mongodb.uri", mongodbDefaultURI(), "Mongodb URI, format: [mongodb://][user:pass@]host1[:port1][,host2[:port2],...][/database][?options]")
)

I find it confusing that flag is --mongodb.uri but env is MONGODB_URL - and looks like not only me https://github.com/percona/mongodb_exporter/pull/113 Do you have any preference to change this? Either to MONGODB_URI or flag to --mongodb.url? MongoDB documentation states https://docs.mongodb.com/manual/reference/connection-string/#connection-string-uri-format I can prepare PR.

arvenil avatar Sep 10 '18 10:09 arvenil