From c34a1b229f83551755fba2dd2c83640f78608e96 Mon Sep 17 00:00:00 2001 From: Frank Hamand Date: Wed, 10 Jul 2024 19:58:52 +0100 Subject: [PATCH] feat: remove postgres token fetch from livestream (#23089) Co-authored-by: James Greenhill --- livestream/main.go | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/livestream/main.go b/livestream/main.go index 3c1fd3487d2..b14d3f94e70 100644 --- a/livestream/main.go +++ b/livestream/main.go @@ -3,6 +3,7 @@ package main import ( "encoding/json" "errors" + "fmt" "log" "net/http" "strconv" @@ -124,12 +125,7 @@ func main() { if err != nil { return err } - teamIdInt := int(claims["team_id"].(float64)) - - token, err := tokenFromTeamId(teamIdInt) - if err != nil { - return err - } + token := fmt.Sprint(claims["api_token"]) var hash *expirable.LRU[string, string] var ok bool @@ -175,6 +171,7 @@ func main() { return err } teamId = strconv.Itoa(int(claims["team_id"].(float64))) + token = fmt.Sprint(claims["api_token"]) log.Printf("~~~~ team found %s", teamId) if teamId == "" { @@ -182,19 +179,6 @@ func main() { } } - if teamId != "" { - teamIdInt64, err := strconv.ParseInt(teamId, 10, 0) - if err != nil { - return err - } - - teamIdInt := int(teamIdInt64) - token, err = tokenFromTeamId(teamIdInt) - if err != nil { - return err - } - } - eventTypes := []string{} if eventType != "" { eventTypes = strings.Split(eventType, ",")