From 0dc46be7ec28bae84a456c2341786af3d087cadc Mon Sep 17 00:00:00 2001 From: Alistair Judson Date: Thu, 6 Feb 2020 11:27:48 +0000 Subject: [PATCH] Add the ability to start the application with out a NewRelic licence key This adds the ability to start an application without a newrelic licence key. --- newrelic/newrelic.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/newrelic/newrelic.go b/newrelic/newrelic.go index 5c15249..f38844e 100644 --- a/newrelic/newrelic.go +++ b/newrelic/newrelic.go @@ -31,10 +31,14 @@ var Service = dependency.Service{ } // NewApp will create a new instance of the *newrelic.Application -func NewApp(config dependency.ConfigGetter, logger *zap.Logger) (*newrelic.Application, error) { +func NewApp(config dependency.ConfigGetter, logger *zap.Logger) (app *newrelic.Application, err error) { + key := config.GetString("newrelic-license-key") + if key == "" { + return app, nil + } return newrelic.NewApplication( newrelic.ConfigAppName(config.GetString("newrelic-app-name")), - newrelic.ConfigLicense(config.GetString("newrelic-license-key")), + newrelic.ConfigLicense(key), newrelic.ConfigDistributedTracerEnabled(config.GetBool("newrelic-distributed-tracer-enabled")), nrzap.ConfigLogger(logger), )