Skip to content

Commit

Permalink
chore: use the wrapper token if it exists (#25381)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuziontech authored Oct 3, 2024
1 parent eba5bb5 commit 5d036bb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion livestream/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type PostHogEventWrapper struct {
DistinctId string `json:"distinct_id"`
Ip string `json:"ip"`
Data string `json:"data"`
Token string `json:"token"`
}

type PostHogEvent struct {
Expand Down Expand Up @@ -109,7 +110,9 @@ func (c *PostHogKafkaConsumer) Consume() {
phEvent.Uuid = wrapperMessage.Uuid
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 {
phEvent.Token = tokenValue
} else {
Expand Down

0 comments on commit 5d036bb

Please sign in to comment.