mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-25 02:49:32 +01:00
37f7c8ec9a
* 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>
22 lines
426 B
Go
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
|
|
}
|