Skip to content

Commit

Permalink
Setup rollbar for the ruby server (#18)
Browse files Browse the repository at this point in the history
* Setup rollbar for the ruby server

* Use rollbar sinatra middleware
  • Loading branch information
joshwlewis authored Jan 5, 2021
1 parent 95ee309 commit 3117a20
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ ruby '>= 2.7.1', '< 2.8'

gem 'sinatra'
gem 'puma'
gem 'rollbar'
8 changes: 7 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ GEM
rack (2.2.3)
rack-protection (2.0.8.1)
rack
rollbar (3.1.1)
ruby2_keywords (0.0.2)
sinatra (2.0.8.1)
mustermann (~> 1.0)
Expand All @@ -19,10 +20,15 @@ GEM

PLATFORMS
ruby
x86_64-darwin-19

DEPENDENCIES
puma
rollbar
sinatra

RUBY VERSION
ruby 2.7.2p137

BUNDLED WITH
2.1.2
2.2.1
13 changes: 13 additions & 0 deletions main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@

Bundler.require

require 'rollbar/middleware/sinatra'
use Rollbar::Middleware::Sinatra

configure do
if ENV.key?('ROLLBAR_ACCESS_TOKEN')
Rollbar.configure do |config|
config.access_token = ENV.fetch('ROLLBAR_ACCESS_TOKEN')
config.environment = ENV.fetch('ROLLBAR_ENVIRONMENT', 'development')
config.root = Dir.pwd
end
end
end

configure { set :server, :puma }
configure { set :port, ENV['PORT'] || 5000 }

Expand Down

0 comments on commit 3117a20

Please sign in to comment.