From b6400c09cad047f04406c87448340f41a8f18728 Mon Sep 17 00:00:00 2001 From: Maxime DAVID Date: Wed, 13 May 2020 14:32:14 -0400 Subject: [PATCH] no more hardcoded localhost --- README.md | 4 +++- lib/index.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dfb6486..e0260b4 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,9 @@ Add middleware immediately before your router. All options are optional. -* `dogstatsd` node-dogstatsd client. `default = new require("node-dogstatsd").StatsD()` +* `dogstatsd_host` *string* host for node-dogstatsd client. `default = localhost`; +* `dogstatsd_port` *number* port for node-dogstatsd client. `default = 8125`; +* `dogstatsd` node-dogstatsd client. `default = new require("node-dogstatsd").StatsD(dogstatsd_host, dogstatsd_port)` * `stat` *string* name for the stat. `default = "node.express.router"` * `tags` *array* of tags to be added to the histogram. `default = []` * `path` *boolean* include path tag. `default = false` diff --git a/lib/index.js b/lib/index.js index e5b2699..54a6373 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,7 +1,9 @@ const hotShots = require("hot-shots"); module.exports = function (options) { - let datadog = options.dogstatsd || new hotShots.StatsD("localhost", 8125); + let dogstatsd_host = options.dogstatsd_host || "localhost"; + let dogstatsd_port = options.dogstatsd_port || 8125; + let datadog = options.dogstatsd || new hotShots.StatsD(dogstatsd_host, dogstatsd_port); let stat = options.stat || "node.express.router"; let tags = options.tags || []; let path = options.path || false;