require_relative 'boot'

require 'rails/all'

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)


require "google/cloud/logging/rails"
require "google/cloud/error_reporting/rails"
require "google/cloud/trace/rails"
require "google/cloud/debugger"

module Rails5App
  class Application < Rails::Application
    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.

    $debugger = Google::Cloud::Debugger.new

    middleware.insert_after Rack::ETag,
                            Google::Cloud::Debugger::Middleware,
                            debugger: $debugger
  end
end
