func main() {
	flag.Parse()
	conf, err := loadConfiguration()
	if err != nil {
		log.Fatal(err)
		return
	}
	verbose, err := strconv.ParseBool(conf.Verbose)
	if err != nil {
		log.Fatal(err)
		return
	}
	airbrakeProjectID, err := strconv.ParseInt(conf.AirbrakeProjectID, 10, 64)
	if err != nil {
		log.Fatal(err)
		return
	}
	airbrake = gobrake.NewNotifier(airbrakeProjectID, conf.AirbrakeProjectKey)
	r := gin.New()
	r.Use(airbrakeRecovery(airbrake)) // Use airbrakeRecovery as early as possible
	r.Use(newrelic.NewRelic(conf.NewRelicLicenseKey, conf.DbName, verbose))
	r.Use(gin.Logger())
	buildRoutes(r)
	r.Run(conf.BindAddress) // listen and serve
}
Beispiel #2
0
// Builds NewRelicService
func (s *NewRelicService) Build(r *gin.Engine) error {
	if !s.Config.Enabled {
		log.Info("NewRelicService is disabled")
		return nil
	}

	r.Use(newrelic.NewRelic(s.Config.LicenseKey, s.Config.AppName, s.Config.Verbose))
	return nil
}