Skip to content

Commit d35f527

Browse files
committed
Fallback to server token if script token isn't provided
1 parent 47443d9 commit d35f527

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

gefcore/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
handler = logging.StreamHandler(stream=sys.stdout)
1414
logger.addHandler(handler)
1515

16-
rollbar_token = os.getenv("ROLLBAR_SCRIPT_TOKEN")
16+
# Use ROLLBAR_SCRIPT_TOKEN if set, otherwise fall back to ROLLBAR_SERVER_TOKEN
17+
rollbar_token = os.getenv("ROLLBAR_SCRIPT_TOKEN") or os.getenv("ROLLBAR_SERVER_TOKEN")
1718
env = os.getenv("ENV")
1819
if rollbar_token and env and env not in ("test", "testing"):
1920
rollbar.init(rollbar_token, env)

gefcore/runner.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
except ImportError:
1616
main = None
1717

18-
rollbar.init(os.getenv("ROLLBAR_SCRIPT_TOKEN"), os.getenv("ENV"))
18+
# Use ROLLBAR_SCRIPT_TOKEN if set, otherwise fall back to ROLLBAR_SERVER_TOKEN
19+
rollbar_token = os.getenv("ROLLBAR_SCRIPT_TOKEN") or os.getenv("ROLLBAR_SERVER_TOKEN")
20+
rollbar.init(rollbar_token, os.getenv("ENV"))
1921

2022
# Silence warning about file_cache being unavailable. See more here:
2123
# https://github.com/googleapis/google-api-python-client/issues/299

0 commit comments

Comments
 (0)