From bf1573293537d3052d3899d288e9be808750f0e9 Mon Sep 17 00:00:00 2001 From: William Petit Date: Mon, 23 Sep 2024 10:13:04 +0200 Subject: [PATCH] feat: disable sentry integration when no dsn is defined --- internal/command/server/admin/run.go | 13 ++++++++----- internal/command/server/proxy/run.go | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/internal/command/server/admin/run.go b/internal/command/server/admin/run.go index e45b25a..a573ce8 100644 --- a/internal/command/server/admin/run.go +++ b/internal/command/server/admin/run.go @@ -35,12 +35,15 @@ func RunCommand() *cli.Command { logger.SetLevel(logger.Level(conf.Logger.Level)) projectVersion := ctx.String("projectVersion") - flushSentry, err := setup.SetupSentry(ctx.Context, conf.Admin.Sentry, projectVersion) - if err != nil { - return errors.Wrap(err, "could not initialize sentry client") - } - defer flushSentry() + if conf.Proxy.Sentry.DSN != "" { + flushSentry, err := setup.SetupSentry(ctx.Context, conf.Proxy.Sentry, projectVersion) + if err != nil { + return errors.Wrap(err, "could not initialize sentry client") + } + + defer flushSentry() + } integrations, err := setup.SetupIntegrations(ctx.Context, conf) if err != nil { diff --git a/internal/command/server/proxy/run.go b/internal/command/server/proxy/run.go index ae0a876..37bde57 100644 --- a/internal/command/server/proxy/run.go +++ b/internal/command/server/proxy/run.go @@ -30,12 +30,15 @@ func RunCommand() *cli.Command { logger.SetLevel(logger.Level(conf.Logger.Level)) projectVersion := ctx.String("projectVersion") - flushSentry, err := setup.SetupSentry(ctx.Context, conf.Proxy.Sentry, projectVersion) - if err != nil { - return errors.Wrap(err, "could not initialize sentry client") - } - defer flushSentry() + if conf.Proxy.Sentry.DSN != "" { + flushSentry, err := setup.SetupSentry(ctx.Context, conf.Proxy.Sentry, projectVersion) + if err != nil { + return errors.Wrap(err, "could not initialize sentry client") + } + + defer flushSentry() + } layers, err := setup.GetLayers(ctx.Context, conf) if err != nil {