change config.env to config.servername

This commit is contained in:
namhq1989 2022-12-15 14:18:01 +07:00
parent a597270424
commit 3cf660b0c4
2 changed files with 6 additions and 6 deletions

View File

@ -3,8 +3,8 @@ package sentry
import "errors"
type Config struct {
Dsn string
Env string
Dsn string
ServerName string
}
func (c Config) validate() error {
@ -12,8 +12,8 @@ func (c Config) validate() error {
return errors.New("sentry DNS is required")
}
if c.Env == "" {
return errors.New("sentry ENV is required")
if c.ServerName == "" {
return errors.New("sentry SERVER_NAME is required")
}
return nil

View File

@ -15,8 +15,8 @@ func WithEcho(e *echo.Echo, cfg Config) error {
}
if err := sentry.Init(sentry.ClientOptions{
Dsn: cfg.Dsn,
Environment: cfg.Env,
Dsn: cfg.Dsn,
ServerName: cfg.ServerName,
}); err != nil {
fmt.Printf("[sentry] initialization failed: %s \n", err.Error())
return err