Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling env var support for license key and app names #501

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions newrelic_plugin_agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ def license_key(self):
:rtype: str

"""
return self.config.application.license_key
licenseKey = os.getenv('NEWRELIC_LICENSE_KEY')
if licenseKey == None:
licenseKey = self.config.application.license_key
return licenseKey

def poll_plugin(self, plugin_name, plugin, config):
"""Kick off a background thread to run the processing task.
Expand All @@ -98,7 +101,10 @@ def poll_plugin(self, plugin_name, plugin, config):
if not isinstance(config, (list, tuple)):
config = [config]

for instance in config:
for idx, instance in enumerate(config):
appName = os.getenv("NEWRELIC_%s_APP_NAME_%i" % (plugin_name.upper(), idx))
if appName != None:
instance.name = appName
thread = threading.Thread(target=self.thread_process,
kwargs={'config': instance,
'name': plugin_name,
Expand Down