0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-24 00:47:50 +01:00

chore: use the wrapper token if it exists (#25381)

This commit is contained in:
James Greenhill 2024-10-03 16:45:44 -07:00 committed by GitHub
parent eba5bb5515
commit 5d036bb48c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,6 +14,7 @@ type PostHogEventWrapper struct {
DistinctId string `json:"distinct_id"` DistinctId string `json:"distinct_id"`
Ip string `json:"ip"` Ip string `json:"ip"`
Data string `json:"data"` Data string `json:"data"`
Token string `json:"token"`
} }
type PostHogEvent struct { type PostHogEvent struct {
@ -109,7 +110,9 @@ func (c *PostHogKafkaConsumer) Consume() {
phEvent.Uuid = wrapperMessage.Uuid phEvent.Uuid = wrapperMessage.Uuid
phEvent.DistinctId = wrapperMessage.DistinctId phEvent.DistinctId = wrapperMessage.DistinctId
if phEvent.Token == "" { if wrapperMessage.Token != "" {
phEvent.Token = wrapperMessage.Token
} else if phEvent.Token == "" {
if tokenValue, ok := phEvent.Properties["token"].(string); ok { if tokenValue, ok := phEvent.Properties["token"].(string); ok {
phEvent.Token = tokenValue phEvent.Token = tokenValue
} else { } else {