diff --git a/README.md b/README.md index 74cfba4a..ba610611 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,12 @@ Get Prometheus MongoDB aggregation query exporter, either as a binaray from the For kubernetes users there is an official helm chart for the MongoDB query exporter. Please read the installation instructions [here](https://github.com/raffis/mongodb-query-exporter/blob/master/chart/mongodb-query-exporter/README.md). +### Docker +You can run the exporter using docker (This will start it using the example config provided in the example folder): +```sh +docker run -e MDBEXPORTER_CONFIG=/config/configv3.yaml -v $(pwd)/example:/config ghcr.io/raffis/mongodb-query-exporter:latest +``` + ## Usage ``` diff --git a/cmd/root.go b/cmd/root.go index a5646d64..24f4cb92 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -152,14 +152,12 @@ func initConfig() { } else { // Find home directory. usr, err := user.Current() - if err != nil { - panic(err) + if err == nil { + viper.AddConfigPath(usr.HomeDir + "/.mongodb_query_exporter") } // System wide config viper.AddConfigPath("/etc/mongodb_query_exporter") - // Search config in home directory with name ".mongodb_query_exporter" (without extension). - viper.AddConfigPath(usr.HomeDir + "/.mongodb_query_exporter") } viper.SetConfigType("yaml")