summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-01-13 20:26:11 -0600
committerDan McGee <dan@archlinux.org>2013-01-13 20:26:52 -0600
commit05f3c5fd199180206dc3c49e967fc9cc18029a8f (patch)
treea23d2cfecb78638368e00d5183dea9329c08a479
parent57730e4917e29421adcbe32fa9f6a1aefd4a5c63 (diff)
Load key before importing newrelic
Their code stupidly grabs the environment variable during import, not during the initialize call. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--.gitignore1
-rw-r--r--archweb.wsgi11
2 files changed, 7 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 7ecfa380..5362f518 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@
local_settings.py
archweb.db
archweb.db-*
+newrelic.key
tags
collected_static/
testing/
diff --git a/archweb.wsgi b/archweb.wsgi
index 901ac98f..f8de2b49 100644
--- a/archweb.wsgi
+++ b/archweb.wsgi
@@ -14,14 +14,15 @@ os.chdir(base_path)
using_newrelic = False
try:
+ key_path = os.path.join(base_path, "newrelic.key")
+ if os.path.exists(key_path):
+ with open(key_path) as keyfile:
+ key = keyfile.read().strip()
+ os.environ["NEW_RELIC_LICENSE_KEY"] = key
+
import newrelic.agent
from newrelic.api.exceptions import ConfigurationError
try:
- key_path = os.path.join(base_path, "newrelic.key")
- if os.path.exists(key_path):
- with open(key_path) as keyfile:
- key = keyfile.read().strip()
- os.environ["NEW_RELIC_LICENSE_KEY"] = key
newrelic.agent.initialize(os.path.join(base_path, "newrelic.ini"))
using_newrelic = True
except ConfigurationError: