Add sentry config
This commit is contained in:
parent
021e3e307b
commit
e62c35b2db
|
@ -32,6 +32,8 @@ service:
|
|||
enabletaskcomments: true
|
||||
# Whether totp is enabled. In most cases you want to leave that enabled.
|
||||
enabletotp: true
|
||||
# If not empty, enables logging of crashes and unhandled errors in sentry.
|
||||
sentrydsn: ''
|
||||
|
||||
database:
|
||||
# Database type to use. Supported types are mysql, postgres and sqlite.
|
||||
|
|
|
@ -75,6 +75,8 @@ service:
|
|||
enabletaskcomments: true
|
||||
# Whether totp is enabled. In most cases you want to leave that enabled.
|
||||
enabletotp: true
|
||||
# If not empty, enables logging of crashes and unhandled errors in sentry.
|
||||
sentrydsn: ''
|
||||
|
||||
database:
|
||||
# Database type to use. Supported types are mysql, postgres and sqlite.
|
||||
|
|
|
@ -49,6 +49,7 @@ const (
|
|||
ServiceTimeZone Key = `service.timezone`
|
||||
ServiceEnableTaskComments Key = `service.enabletaskcomments`
|
||||
ServiceEnableTotp Key = `service.enabletotp`
|
||||
ServiceSentryDsn Key = `service.sentrydsn`
|
||||
|
||||
DatabaseType Key = `database.type`
|
||||
DatabaseHost Key = `database.host`
|
||||
|
|
|
@ -62,6 +62,7 @@ import (
|
|||
"code.vikunja.io/web"
|
||||
"code.vikunja.io/web/handler"
|
||||
"github.com/asaskevich/govalidator"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/echo/v4/middleware"
|
||||
elog "github.com/labstack/gommon/log"
|
||||
|
@ -116,6 +117,17 @@ func NewEcho() *echo.Echo {
|
|||
}))
|
||||
}
|
||||
|
||||
if config.ServiceSentryDsn.GetString() != "" {
|
||||
e.HTTPErrorHandler = func(err error, c echo.Context) {
|
||||
|
||||
sentry.Init(sentry.ClientOptions{
|
||||
Dsn: config.ServiceSentryDsn.GetString(),
|
||||
})
|
||||
|
||||
e.DefaultHTTPErrorHandler(err, c)
|
||||
}
|
||||
}
|
||||
|
||||
// Validation
|
||||
e.Validator = &CustomValidator{}
|
||||
|
||||
|
|
Loading…
Reference in New Issue