0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-24 18:07:17 +01:00
posthog/livestream/posthog.go
James Greenhill 37f7c8ec9a
chore: add sentry to liveevents (#23057)
* chore: add sentry to liveevents

* Use `isProd` for `Debug`

* Add a bunch of `CaptureException` calls

* Properly bubble `getPGConn()` error

* Fix `ParseIP` error handling

* Remove unused `personFromDistinctId()`

---------

Co-authored-by: Michael Matloka <dev@twixes.com>
Co-authored-by: Michael Matloka <michal@matloka.com>
2024-06-19 21:23:55 +00:00

22 lines
426 B
Go

package main
import (
"context"
)
func tokenFromTeamId(teamId int) (string, error) {
pgConn, pgConnErr := getPGConn()
if pgConnErr != nil {
return "", pgConnErr
}
defer pgConn.Close(context.Background())
var token string
queryErr := pgConn.QueryRow(context.Background(), "select api_token from posthog_team where id = $1;", teamId).Scan(&token)
if queryErr != nil {
return "", queryErr
}
return token, nil
}