remove sentry
This commit is contained in:
parent
8ff8a63299
commit
62803d451d
2 changed files with 7 additions and 33 deletions
|
@ -7,7 +7,6 @@ import (
|
||||||
"code.lila.network/adoralaura/certwarden-deploy/internal/certificates"
|
"code.lila.network/adoralaura/certwarden-deploy/internal/certificates"
|
||||||
"code.lila.network/adoralaura/certwarden-deploy/internal/configuration"
|
"code.lila.network/adoralaura/certwarden-deploy/internal/configuration"
|
||||||
"code.lila.network/adoralaura/certwarden-deploy/internal/constants"
|
"code.lila.network/adoralaura/certwarden-deploy/internal/constants"
|
||||||
"code.lila.network/adoralaura/certwarden-deploy/internal/errlog"
|
|
||||||
"code.lila.network/adoralaura/certwarden-deploy/internal/logger"
|
"code.lila.network/adoralaura/certwarden-deploy/internal/logger"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
@ -32,12 +31,14 @@ func handleRootCmd(cmd *cobra.Command, args []string) {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
log := logger.InitializeLogger()
|
log := logger.InitializeLogger()
|
||||||
err = errlog.SetupSentry(log, config.Sentry.DSN)
|
config.SubstituteKeys(log)
|
||||||
if err != nil {
|
|
||||||
slog.Error("failed to initialize sentry", "error", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
configuration.ValidateConfig(log, *config)
|
validation := config.IsValid()
|
||||||
|
if validation.HasMessages() {
|
||||||
|
validation.Print(log)
|
||||||
|
slog.Error("The configuration file has errors! Application cannot start unless all errors are corrected!")
|
||||||
|
panic(1)
|
||||||
|
}
|
||||||
|
|
||||||
certificates.HandleCertificates(log, config)
|
certificates.HandleCertificates(log, config)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
package errlog
|
|
||||||
|
|
||||||
import (
|
|
||||||
"log/slog"
|
|
||||||
|
|
||||||
"github.com/getsentry/sentry-go"
|
|
||||||
)
|
|
||||||
|
|
||||||
func SetupSentry(logger *slog.Logger, dsn string) error {
|
|
||||||
if dsn == "" {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
err := sentry.Init(sentry.ClientOptions{
|
|
||||||
Dsn: dsn,
|
|
||||||
// Set TracesSampleRate to 1.0 to capture 100%
|
|
||||||
// of transactions for performance monitoring.
|
|
||||||
// We recommend adjusting this value in production,
|
|
||||||
TracesSampleRate: 1.0,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
logger.Error("failed to set up sentry")
|
|
||||||
}
|
|
||||||
// Flush buffered events before the program terminates.
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
Loading…
Reference in a new issue