Skip to content

Commit

Permalink
feat: remove postgres token fetch from livestream (#23089)
Browse files Browse the repository at this point in the history
Co-authored-by: James Greenhill <[email protected]>
  • Loading branch information
frankh and fuziontech authored Jul 10, 2024
1 parent 367f6f8 commit c34a1b2
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions livestream/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"encoding/json"
"errors"
"fmt"
"log"
"net/http"
"strconv"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -175,26 +171,14 @@ 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 == "" {
return errors.New("teamId is required unless geo=true")
}
}

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, ",")
Expand Down

0 comments on commit c34a1b2

Please sign in to comment.