From d34a86df19f2ba2a9b5e65323fc3b7285858003d Mon Sep 17 00:00:00 2001 From: Sanjay Date: Mon, 11 Nov 2024 15:57:35 -0800 Subject: [PATCH] fix(shuttle): Use statsd host from env (#2399) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Why is this change needed? Use statsd host from env for shuttle ## Merge Checklist _Choose all relevant options below by adding an `x` now or at any time before submitting for review_ - [x] PR title adheres to the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) standard - [x] PR has a [changeset](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#35-adding-changesets) - [x] PR has been tagged with a change label(s) (i.e. documentation, feature, bugfix, or chore) - [ ] PR includes [documentation](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#32-writing-docs) if necessary. --- ## PR-Codex overview This PR focuses on updating the `statsd` configuration in the `shuttle` package to use the `STATSD_HOST` environment variable for the host address, enhancing flexibility and avoiding hardcoded values. ### Detailed summary - Updated `host` in `statsd` configuration from a hardcoded IP (`"127.0.0.1"`) to use `process.env["STATSD_HOST"]` with a fallback to `"127.0.0.1"`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .changeset/shaggy-hounds-scream.md | 5 +++++ packages/shuttle/src/statsd.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/shaggy-hounds-scream.md diff --git a/.changeset/shaggy-hounds-scream.md b/.changeset/shaggy-hounds-scream.md new file mode 100644 index 0000000000..832d627afe --- /dev/null +++ b/.changeset/shaggy-hounds-scream.md @@ -0,0 +1,5 @@ +--- +"@farcaster/shuttle": patch +--- + +fix: Use statsd host from env diff --git a/packages/shuttle/src/statsd.ts b/packages/shuttle/src/statsd.ts index 7b30227e0e..039681879a 100644 --- a/packages/shuttle/src/statsd.ts +++ b/packages/shuttle/src/statsd.ts @@ -4,7 +4,7 @@ import { isIP } from "node:net"; import StatsD from "@farcaster/hot-shots"; export const statsd = new StatsD({ - host: "127.0.0.1", // Avoid Node.js deprecation warning by specifying explicitly + host: process.env["STATSD_HOST"] || "127.0.0.1", cacheDns: true, maxBufferSize: 4096 /* 4KiB */, udpSocketOptions: {