diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2025-07-24 14:40:22 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2025-07-24 14:40:22 +0300 |
| commit | b0d199936b546c75d4b19d99591237f0bf97fe55 (patch) | |
| tree | e9391880e7db2bd1ea8ff25d91aeea8dd98f186e /backend/main.go | |
| parent | fix/frontend: fixed sidebar title size, removed unnecessary imports (diff) | |
| parent | feat/backend: add newrelic integration (#274) (diff) | |
| download | lphub-b0d199936b546c75d4b19d99591237f0bf97fe55.tar.gz lphub-b0d199936b546c75d4b19d99591237f0bf97fe55.tar.bz2 lphub-b0d199936b546c75d4b19d99591237f0bf97fe55.zip | |
Merge branch 'main' into css-overhaulcss-overhaul
Diffstat (limited to 'backend/main.go')
| -rw-r--r-- | backend/main.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/backend/main.go b/backend/main.go index a1a4a20..e422359 100644 --- a/backend/main.go +++ b/backend/main.go | |||
| @@ -11,6 +11,8 @@ import ( | |||
| 11 | 11 | ||
| 12 | "github.com/gin-gonic/gin" | 12 | "github.com/gin-gonic/gin" |
| 13 | "github.com/joho/godotenv" | 13 | "github.com/joho/godotenv" |
| 14 | nrgin "github.com/newrelic/go-agent/v3/integrations/nrgin" | ||
| 15 | "github.com/newrelic/go-agent/v3/newrelic" | ||
| 14 | ) | 16 | ) |
| 15 | 17 | ||
| 16 | // @title Least Portals Hub | 18 | // @title Least Portals Hub |
| @@ -30,7 +32,16 @@ func main() { | |||
| 30 | if os.Getenv("ENV") == "PROD" { | 32 | if os.Getenv("ENV") == "PROD" { |
| 31 | gin.SetMode(gin.ReleaseMode) | 33 | gin.SetMode(gin.ReleaseMode) |
| 32 | } | 34 | } |
| 35 | app, err := newrelic.NewApplication( | ||
| 36 | newrelic.ConfigAppName("lphub"), | ||
| 37 | newrelic.ConfigLicense(os.Getenv("NEWRELIC_LICENSE_KEY")), | ||
| 38 | newrelic.ConfigAppLogForwardingEnabled(true), | ||
| 39 | ) | ||
| 40 | if err != nil { | ||
| 41 | log.Fatal("Error instrumenting newrelic") | ||
| 42 | } | ||
| 33 | router := gin.Default() | 43 | router := gin.Default() |
| 44 | router.Use(nrgin.Middleware(app)) | ||
| 34 | database.ConnectDB() | 45 | database.ConnectDB() |
| 35 | api.InitRoutes(router) | 46 | api.InitRoutes(router) |
| 36 | // for debugging | 47 | // for debugging |