mirror of
https://github.com/PostHog/posthog.git
synced 2024-12-01 12:21:02 +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>
20 lines
345 B
Go
20 lines
345 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/getsentry/sentry-go"
|
|
"github.com/jackc/pgx/v5"
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
func getPGConn() (*pgx.Conn, error) {
|
|
url := viper.GetString("postgres.url")
|
|
conn, err := pgx.Connect(context.Background(), url)
|
|
if err != nil {
|
|
sentry.CaptureException(err)
|
|
return nil, err
|
|
}
|
|
return conn, nil
|
|
}
|