Skip to content

Commit 9219b55

Browse files
committed
feat: Fall back to NODE_ENV for Sentry Environment
1 parent a692001 commit 9219b55

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

docs/config.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,4 +241,4 @@ Environment Variables
241241

242242
.. describe:: SENTRY_ENVIRONMENT
243243

244-
Optionally set the environment name, e.g. "staging", "production".
244+
Optionally set the environment name, e.g. "staging", "production". Sentry will default to the value of `NODE_ENV`, if present.

lib/client.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ extend(Raven.prototype, {
5454
this.transport = options.transport || transports[this.dsn.protocol];
5555
this.sendTimeout = options.sendTimeout || 1;
5656
this.release = options.release || process.env.SENTRY_RELEASE || '';
57-
this.environment = options.environment || process.env.SENTRY_ENVIRONMENT || '';
57+
this.environment =
58+
options.environment || process.env.SENTRY_ENVIRONMENT || process.env.NODE_ENV || '';
5859

5960
// autoBreadcrumbs: true enables all, autoBreadcrumbs: false disables all
6061
// autoBreadcrumbs: { http: true } enables a single type

0 commit comments

Comments
 (0)