From b791fb061c716dc7a2521ca95837438bc77283b9 Mon Sep 17 00:00:00 2001 From: Kuba Orlik Date: Fri, 25 Jul 2025 16:39:25 +0200 Subject: [PATCH 1/2] Use custom hostname if it's provided in payload --- src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index fa13441..e297a5a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,7 +9,10 @@ export const eventHandler = async ( ) => { const { payload, client } = event - const { writeKey, hostname = 'api.segment.io' } = settings + let { writeKey, hostname = 'api.segment.io' } = settings + if (payload.hostname) { + hostname = payload.hostname + } const endpoint = `https://${hostname}/v1/${eventType}` // Prepare new payload From 647019894f08599f9cea1062ae9c8c7d7373d478 Mon Sep 17 00:00:00 2001 From: Kuba Orlik Date: Fri, 25 Jul 2025 16:42:57 +0200 Subject: [PATCH 2/2] Fix linter --- src/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index e297a5a..100a956 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,12 +9,14 @@ export const eventHandler = async ( ) => { const { payload, client } = event - let { writeKey, hostname = 'api.segment.io' } = settings + let { hostname = 'api.segment.io' } = settings if (payload.hostname) { hostname = payload.hostname } const endpoint = `https://${hostname}/v1/${eventType}` + const { writeKey } = settings + // Prepare new payload const uaParser = new UAParser(client.userAgent).getResult() /* eslint-disable @typescript-eslint/no-explicit-any */