Compare commits
1 Commits
2023.10.13
...
2023.10.13
Author | SHA1 | Date | |
---|---|---|---|
e756a60373 |
@ -8,10 +8,10 @@ import (
|
||||
"time"
|
||||
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/command/common"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli/v2"
|
||||
"gitlab.com/wpetit/goweb/logger"
|
||||
)
|
||||
|
||||
func Main(buildDate, projectVersion, gitRef, defaultConfigPath string, commands ...*cli.Command) {
|
||||
@ -55,16 +55,14 @@ func Main(buildDate, projectVersion, gitRef, defaultConfigPath string, commands
|
||||
}
|
||||
|
||||
if conf.Sentry.DSN != "" {
|
||||
spew.Dump(conf.Sentry)
|
||||
|
||||
err = sentry.Init(sentry.ClientOptions{
|
||||
Dsn: conf.Sentry.DSN,
|
||||
Dsn: string(conf.Sentry.DSN),
|
||||
Debug: ctx.Bool("debug"),
|
||||
AttachStacktrace: true,
|
||||
Environment: conf.Sentry.Environment,
|
||||
Environment: string(conf.Sentry.Environment),
|
||||
})
|
||||
if err != nil {
|
||||
return errors.WithStack(err)
|
||||
logger.Error(ctx.Context, "could not initialize sentry", logger.E(errors.WithStack(err)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,14 +5,14 @@ import (
|
||||
)
|
||||
|
||||
type SentryConfig struct {
|
||||
DSN string `yaml:"dsn"`
|
||||
Environment string `yaml:"environment"`
|
||||
DSN InterpolatedString `yaml:"dsn"`
|
||||
Environment InterpolatedString `yaml:"environment"`
|
||||
}
|
||||
|
||||
func NewDefaultSentryConfig() SentryConfig {
|
||||
hostname, _ := os.Hostname()
|
||||
return SentryConfig{
|
||||
DSN: "",
|
||||
Environment: hostname,
|
||||
Environment: InterpolatedString(hostname),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user