Skip to content

Commit

Permalink
disable extension if env vars are false
Browse files Browse the repository at this point in the history
  • Loading branch information
chaudharysaket committed Sep 5, 2024
1 parent 8a15ffa commit 12a793a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ type Configuration struct {
}

func ConfigurationFromEnvironment() *Configuration {
enabledStr, extensionEnabledOverride := os.LookupEnv("NEW_RELIC_LAMBDA_EXTENSION_ENABLED")
nrEnabledStr, nrEnabledOverride := os.LookupEnv("NEW_RELIC_ENABLED")
nrEnabledRubyStr, nrEnabledRubyOverride := os.LookupEnv("NEW_RELIC_AGENT_ENABLED")
enabledStr, extensionEnabledOverride := os.LookupEnv("NEW_RELIC_LAMBDA_EXTENSION_ENABLED")
licenseKey, lkOverride := os.LookupEnv("NEW_RELIC_LICENSE_KEY")
licenseKeySecretId, lkSecretOverride := os.LookupEnv("NEW_RELIC_LICENSE_KEY_SECRET")
licenseKeySSMParameterName, lkSSMParameterOverride := os.LookupEnv("NEW_RELIC_LICENSE_KEY_SSM_PARAMETER_NAME")
Expand All @@ -57,6 +57,12 @@ func ConfigurationFromEnvironment() *Configuration {
collectTraceIDStr, collectTraceIDOverride := os.LookupEnv("NEW_RELIC_COLLECT_TRACE_ID")

extensionEnabled := true
if nrEnabledOverride && strings.ToLower(nrEnabledStr) == "false" {
extensionEnabled = false
}
if nrEnabledRubyOverride && strings.ToLower(nrEnabledRubyStr) == "false" {
extensionEnabled = false
}
if extensionEnabledOverride && strings.ToLower(enabledStr) == "false" {
extensionEnabled = false
}
Expand Down

0 comments on commit 12a793a

Please sign in to comment.