mirror of
https://github.com/getAlby/lndhub.go.git
synced 2026-01-10 16:35:38 +01:00
make sentry optional and panic on error
This commit is contained in:
20
cmd/main.go
20
cmd/main.go
@@ -7,6 +7,7 @@ import (
|
||||
"os/signal"
|
||||
"time"
|
||||
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"github.com/joho/godotenv"
|
||||
"github.com/labstack/echo/v4"
|
||||
@@ -34,13 +35,20 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
err = sentry.Init(sentry.ClientOptions{
|
||||
Dsn: os.Getenv("SENTRY_DSN"),
|
||||
})
|
||||
if err != nil {
|
||||
logrus.Errorf("sentry init error: %v", err)
|
||||
sentryDsn := os.Getenv("SENTRY_DSN")
|
||||
|
||||
switch sentryDsn {
|
||||
case "":
|
||||
//ignore
|
||||
break
|
||||
default:
|
||||
if err = sentry.Init(sentry.ClientOptions{
|
||||
Dsn: os.Getenv("SENTRY_DSN"),
|
||||
}); err != nil {
|
||||
logrus.Fatalf("sentry init error: %v", err)
|
||||
}
|
||||
defer sentry.Flush(2 * time.Second)
|
||||
}
|
||||
defer sentry.Flush(2 * time.Second)
|
||||
|
||||
e := echo.New()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user