Class: Sqreen::Frameworks::SinatraFramework

Inherits:
GenericFramework show all
Defined in:
lib/sqreen/frameworks/sinatra.rb

Overview

Handle Sinatra specific functions

Constant Summary

Constants inherited from GenericFramework

GenericFramework::LOCALHOST, GenericFramework::PREFERRED_IP_HEADERS, GenericFramework::P_COOKIE, GenericFramework::P_FORM, GenericFramework::P_GRAPE, GenericFramework::P_QUERY, GenericFramework::P_RACK, GenericFramework::P_RACK_ROUTING, GenericFramework::TRUSTED_PROXIES

Instance Attribute Summary

Attributes inherited from GenericFramework

#req_end_cb, #req_start_cb, #sqreen_configuration

Instance Method Summary collapse

Methods inherited from GenericFramework

#application_name, #body, #clean_request, #client_ip, #client_user_agent, cookies_params, #cwd, #datadog_span, #development?, #filtered_request_params, form_params, #full_params_include?, #graphql_args=, #header, #hostname, #http_headers, #initialize, #instrument_when_ready!, #ip_headers, #mark_request_overtime!, parameters_from_request, #params_include?, #prevent_startup, query_params, #rack_client_ip, rack_params, #remaining_perf_budget, #remaining_perf_budget=, #remote_addr, #request, #request_id, #request_infos, #request_params, #request_path, #response, #response_infos, #root, #store_request, #store_response, #test?, #whitelisted_ip, #whitelisted_match, #whitelisted_path, #xss_params

Methods included from RequestRecorder

#clean_request_record, #close_request_record, #observe, #observed_items, #observed_items=, #only_metric_observation, #only_metric_observation=, #payload_requests, #payload_requests=

Constructor Details

This class inherits a constructor from Sqreen::Frameworks::GenericFramework

Instance Method Details

#db_settings(options = {}) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/sqreen/frameworks/sinatra.rb', line 22

def db_settings(options = {})
  adapter = options[:connection_adapter]
  return nil unless adapter

  begin
    adapter_name = adapter.class.const_get 'ADAPTER_NAME'
  rescue
    # FIXME: we may want to log that
    Sqreen.log.warn 'cannot find ADAPTER_NAME'
    return nil
  end
  db_type = DB_MAPPING[adapter_name]
  db_infos = { :name => adapter_name }
  [db_type, db_infos]
end

#framework_infosObject



15
16
17
18
19
20
# File 'lib/sqreen/frameworks/sinatra.rb', line 15

def framework_infos
  h = super
  h[:framework_type] = 'Sinatra'
  h[:framework_version] = Sinatra::VERSION
  h
end