From 9d061c6f3ec8fb2708512a9484371521d01d06c0 Mon Sep 17 00:00:00 2001 From: DarthSim Date: Mon, 17 May 2021 18:27:04 +0600 Subject: [PATCH] Fix airbrake --- config.go | 4 ++-- errors_reporting.go | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config.go b/config.go index bd86ee0f..9707cdc2 100644 --- a/config.go +++ b/config.go @@ -299,7 +299,7 @@ type config struct { SentryDSN string SentryEnvironment string SentryRelease string - AirbrakeProjecId int + AirbrakeProjecID int AirbrakeProjecKey string AirbrakeEnv string @@ -481,7 +481,7 @@ func configure() error { strEnvConfig(&conf.SentryDSN, "IMGPROXY_SENTRY_DSN") strEnvConfig(&conf.SentryEnvironment, "IMGPROXY_SENTRY_ENVIRONMENT") strEnvConfig(&conf.SentryRelease, "IMGPROXY_SENTRY_RELEASE") - intEnvConfig(&conf.AirbrakeProjecId, "IMGPROXY_AIRBRAKE_PROJECT_ID") + intEnvConfig(&conf.AirbrakeProjecID, "IMGPROXY_AIRBRAKE_PROJECT_ID") strEnvConfig(&conf.AirbrakeProjecKey, "IMGPROXY_AIRBRAKE_PROJECT_KEY") strEnvConfig(&conf.AirbrakeEnv, "IMGPROXY_AIRBRAKE_ENVIRONMENT") boolEnvConfig(&conf.ReportDownloadingErrors, "IMGPROXY_REPORT_DOWNLOADING_ERRORS") diff --git a/errors_reporting.go b/errors_reporting.go index f2379305..9d875071 100644 --- a/errors_reporting.go +++ b/errors_reporting.go @@ -51,7 +51,7 @@ func initErrorsReporting() { if len(conf.AirbrakeProjecKey) > 0 { airbrake = gobrake.NewNotifierWithOptions(&gobrake.NotifierOptions{ - ProjectId: int64(conf.AirbrakeProjecId), + ProjectId: int64(conf.AirbrakeProjecID), ProjectKey: conf.AirbrakeProjecKey, Environment: conf.AirbrakeEnv, }) @@ -61,7 +61,9 @@ func initErrorsReporting() { } func closeErrorsReporting() { - airbrake.Close() + if airbrake != nil { + airbrake.Close() + } } func reportError(err error, req *http.Request) {