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