Skip to content

Commit

Permalink
add in environment option (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
James Baxley authored and benvinegar committed Jul 29, 2016
1 parent c1035b5 commit 14401a2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var Client = function Client(dsn, options) {
this.root = options.root || process.cwd();
this.transport = options.transport || transports[this.dsn.protocol];
this.release = options.release || process.env.SENTRY_RELEASE || '';
this.environment = options.environment || process.env.SENTRY_ENVIRONMENT || '';

this.loggerName = options.logger || '';
this.dataCallback = options.dataCallback;
Expand Down
14 changes: 14 additions & 0 deletions test/raven.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,20 @@ describe('raven.Client', function() {
delete process.env.SENTRY_RELEASE;
});

it('should pull environment from options if present', function() {
var client = new raven.Client(dsn, {
environment: 'staging'
});
client.environment.should.eql('staging');
});

it('should pull SENTRY_ENVIRONMENT from environment', function() {
process.env.SENTRY_ENVIRONMENT = 'staging';
var client = new raven.Client(dsn);
client.environment.should.eql('staging');
delete process.env.SENTRY_ENVIRONMENT;
});

describe('#getIdent()', function() {
it('should match', function() {
var result = {
Expand Down

0 comments on commit 14401a2

Please sign in to comment.