Class: Sqreen::Kit::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/sqreen/kit/configuration.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_keyObject

authentication



30
31
32
# File 'lib/sqreen/kit/configuration.rb', line 30

def api_key
  @api_key
end

.app_nameObject

authentication



30
31
32
# File 'lib/sqreen/kit/configuration.rb', line 30

def app_name
  @app_name
end

.batch_flush_sizeObject

batch collector



35
36
37
# File 'lib/sqreen/kit/configuration.rb', line 35

def batch_flush_size
  @batch_flush_size
end

.batch_max_delay_sObject

batch collector



35
36
37
# File 'lib/sqreen/kit/configuration.rb', line 35

def batch_max_delay_s
  @batch_max_delay_s
end

.batch_max_sizeObject

batch collector



35
36
37
# File 'lib/sqreen/kit/configuration.rb', line 35

def batch_max_size
  @batch_max_size
end

.certificate_storeObject

http client related



16
17
18
# File 'lib/sqreen/kit/configuration.rb', line 16

def certificate_store
  @certificate_store
end

.connect_timeoutObject

http client related



16
17
18
# File 'lib/sqreen/kit/configuration.rb', line 16

def connect_timeout
  @connect_timeout
end

.default_sourceObject

Default value for source in signals taking a generic value Something like ‘sqreen:agent:ruby:1.11.1’ XXX: do not provide default and force user to explicitly set source?



42
43
44
# File 'lib/sqreen/kit/configuration.rb', line 42

def default_source
  @default_source
end

.ingestion_urlObject

http client related



16
17
18
# File 'lib/sqreen/kit/configuration.rb', line 16

def ingestion_url
  @ingestion_url
end

.loggerObject

Returns the value of attribute logger.



13
14
15
# File 'lib/sqreen/kit/configuration.rb', line 13

def logger
  @logger
end

.proxy_addressObject

http client related



16
17
18
# File 'lib/sqreen/kit/configuration.rb', line 16

def proxy_address
  @proxy_address
end

.proxy_passObject

http client related



16
17
18
# File 'lib/sqreen/kit/configuration.rb', line 16

def proxy_pass
  @proxy_pass
end

.proxy_portObject

http client related



16
17
18
# File 'lib/sqreen/kit/configuration.rb', line 16

def proxy_port
  @proxy_port
end

.proxy_userObject

http client related



16
17
18
# File 'lib/sqreen/kit/configuration.rb', line 16

def proxy_user
  @proxy_user
end

.read_timeoutObject

http client related



16
17
18
# File 'lib/sqreen/kit/configuration.rb', line 16

def read_timeout
  @read_timeout
end

.retry_max_retriesObject

retry policy



26
27
28
# File 'lib/sqreen/kit/configuration.rb', line 26

def retry_max_retries
  @retry_max_retries
end

.retry_wait_sObject

retry policy



26
27
28
# File 'lib/sqreen/kit/configuration.rb', line 26

def retry_wait_s
  @retry_wait_s
end

.session_keyObject

authentication



30
31
32
# File 'lib/sqreen/kit/configuration.rb', line 30

def session_key
  @session_key
end

Class Method Details

.proxy_url=(url) ⇒ Object

Parameters:

  • url (String)

Raises:

  • (ArgumentError)


45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/sqreen/kit/configuration.rb', line 45

def proxy_url=(url)
  if url.nil?
    self.proxy_address =
      self.proxy_port =
        self.proxy_user =
          self.proxy_pass = nil
    return
  end

  parsed = URI.parse(url)
  raise ArgumentError, 'only http proxies are supported' unless parsed.scheme == 'http'

  self.proxy_address = parsed.host
  self.proxy_port = parsed.port
  self.proxy_user = parsed.user
  self.proxy_port = parsed.port
end

.set_defaultsObject

default values



65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/sqreen/kit/configuration.rb', line 65

def self.set_defaults
  instance_variables.each do |ia|
    instance_variable_set(ia, nil)
  end
  self.logger = ::Logger.new(STDERR)
  logger.level = ::Logger::WARN
  logger.progname = 'sqreen-kit'

  self.ingestion_url = 'https://ingestion.sqreen.com/'

  self.default_source = "sqreen:kit:#{Sqreen::Kit.version}"
end