Skip to content

Commit b791fb0

Browse files
committed
Use custom hostname if it's provided in payload
1 parent d3d2c3b commit b791fb0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ export const eventHandler = async (
99
) => {
1010
const { payload, client } = event
1111

12-
const { writeKey, hostname = 'api.segment.io' } = settings
12+
let { writeKey, hostname = 'api.segment.io' } = settings
13+
if (payload.hostname) {
14+
hostname = payload.hostname
15+
}
1316
const endpoint = `https://${hostname}/v1/${eventType}`
1417

1518
// Prepare new payload

0 commit comments

Comments
 (0)