diff --git a/Gemfile b/Gemfile index ad3591a..52f54ec 100644 --- a/Gemfile +++ b/Gemfile @@ -4,3 +4,4 @@ ruby '>= 2.7.1', '< 2.8' gem 'sinatra' gem 'puma' +gem 'rollbar' diff --git a/Gemfile.lock b/Gemfile.lock index 71430b5..9f89784 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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 diff --git a/main.rb b/main.rb index 8ae2ef1..ee490e0 100644 --- a/main.rb +++ b/main.rb @@ -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 }