require 'appsignal'
require 'appsignal/rack/sinatra_instrumentation'

Appsignal.logger.info("Loading Sinatra (#{Sinatra::VERSION}) integration")

app_settings = ::Sinatra::Application.settings
Appsignal.config = Appsignal::Config.new(
  app_settings.root,
  app_settings.environment
)

Appsignal.start_logger
Appsignal.start

if Appsignal.active?
  ::Sinatra::Application.use(Appsignal::Rack::SinatraInstrumentation)
end

require 'appsignal'
require 'appsignal/rack/sinatra_instrumentation'

Appsignal.logger.info("Loading Sinatra (#{Sinatra::VERSION}) integration")

app_settings = ::Sinatra::Application.settings
Appsignal.config = Appsignal::Config.new(
  app_settings.root || Dir.pwd,
  app_settings.environment
)

Appsignal.start_logger
Appsignal.start

if Appsignal.active?
  ::Sinatra::Application.use(Appsignal::Rack::SinatraInstrumentation)
end

Fix AppSignal loading when using Sinatra::Base
Fix AppSignal loading when using Sinatra::Base

Looks like that when using `require "sinatra/base"` instead of
`require "sinatra"` the root path is not set on the sinatra application.
The user should do this themselves, but it's not required.

https://github.com/sinatra/sinatra/blob/d51513d094d1fe01543e546d07ef48663ecc2d8f/test/settings_test.rb#L453-L466

To prevent this kind of behavior (AppSignal not working because a user
didn't specify a root path) we set a default path like AppSignal does in
https://github.com/appsignal/appsignal-ruby/blob/f9b51bdaee3402876adeab1f624f090b2786f268/lib/appsignal.rb#L42