Intégration de Sentry

This commit is contained in:
2020-10-12 14:35:02 +02:00
parent 27458b5b94
commit d0cd9842ea
5 changed files with 195 additions and 1 deletions

View File

@ -23,6 +23,7 @@ type Config struct {
Auth AuthConfig `yaml:"auth"`
SMTP SMTPConfig `yaml:"smtp"`
Task TaskConfig `yaml:"task"`
Sentry SentryConfig `ymal:"sentry"`
}
// NewFromFile retrieves the configuration from the given file
@ -101,6 +102,14 @@ type NewsletterTaskConfig struct {
SubjectTemplate string `yaml:"subjectTemplate" env:"TASK_NEWSLETTER_SUBJECT_TEMPLATE"`
}
type SentryConfig struct {
DSN string `yaml:"dsn" env:"SENTRY_DSN"`
// Server events sampling rate, see https://docs.sentry.io/platforms/go/configuration/options/
ServerSampleRate float64 `yaml:"serverSampleRate" env:"SENTRY_SERVER_SAMPLE_RATE"`
ServerFlushTimeout time.Duration `yaml:"serverFlushTimeout" env:"SENTRY_SERVER_FLUSH_TIMEOUT"`
Environment string `yaml:"environment" env:"SENTRY_ENVIRONMENT"`
}
func NewDumpDefault() *Config {
config := NewDefault()
return config
@ -209,6 +218,12 @@ func NewDefault() *Config {
SubjectTemplate: `[Daddy] Évènements du {{ .From.Format "02/01/2006" }} au {{ .To.Format "02/01/2006" }}`,
},
},
Sentry: SentryConfig{
DSN: "",
ServerSampleRate: 1,
ServerFlushTimeout: 2 * time.Second,
Environment: "",
},
}
}