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

Ignore empty ROLLBAR_ENV #604

Merged
merged 1 commit into from
Jul 11, 2017
Merged

Ignore empty ROLLBAR_ENV #604

merged 1 commit into from
Jul 11, 2017

Conversation

gr8bit
Copy link
Contributor

@gr8bit gr8bit commented Jun 15, 2017

If ENV variables are not set, they appear as nil in ruby when accessed. If they are empty, they appear as en empty string "" to ruby. An empty strings is true when used with || operator in ruby. As we want to have an environment set for Rollbar, we should use .presence to ignore empty ROLLBAR_ENV variables and use the Rails.env instead.

$ ENV_FOO=test ENV_BAR= be rails c
Loading development environment (Rails 5.0.3)
2.3.3 :001 > ENV['ENV_FOO']
 => "test" 
2.3.3 :002 > ENV['ENV_BAR']
 => "" 
2.3.3 :003 > ENV['ENV_BAZ']
 => nil 

If ENV variables are not set, they appear as `nil` in ruby when accessed. If they are empty, they appear as en empty string `""` to ruby. An empty strings is true when used with `||` operator in ruby. As we want to have an environment set for Rollbar, we should use .presence to ignore empty ROLLBAR_ENV variables and use the Rails.env instead.

```bash
$ ENV_FOO=test ENV_BAR= be rails c
Loading development environment (Rails 5.0.3)
2.3.3 :001 > ENV['ENV_FOO']
 => "test" 
2.3.3 :002 > ENV['ENV_BAR']
 => "" 
2.3.3 :003 > ENV['ENV_BAZ']
 => nil 
```
@gr8bit
Copy link
Contributor Author

gr8bit commented Jun 15, 2017

Failures are travis-internal:

Finished in 10.42 seconds (files took 5.08 seconds to load)
400 examples, 0 failures
Randomized with seed 14174
/home/travis/build/rollbar/rollbar-gem/lib/rollbar/delay/thread.rb:58:in `rescue in block in configure_exit_handler': unable to reap all threads within 3 seconds (Rollbar::Delay::Thread::TimeoutError)
	from /home/travis/build/rollbar/rollbar-gem/lib/rollbar/delay/thread.rb:52:in `block in configure_exit_handler'
/home/travis/.rvm/rubies/ruby-2.0.0-p598/bin/ruby -I/home/travis/.rvm/gems/ruby-2.0.0-p598/gems/rspec-core-3.6.0/lib:/home/travis/.rvm/gems/ruby-2.0.0-p598/gems/rspec-support-3.6.0/lib /home/travis/.rvm/gems/ruby-2.0.0-p598/gems/rspec-core-3.6.0/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed

@rokob
Copy link
Contributor

rokob commented Jul 11, 2017

LGTM, the travis result is unrelated as you say.

@rokob rokob merged commit e1264e8 into rollbar:master Jul 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants