Sha256: cbc1eb724faec7e455571dc3d63baf0fcf66e7938a4e7f4c856e050acf1de457
Contents?: true
Size: 1.55 KB
Versions: 4
Compression:
Stored size: 1.55 KB
Contents
# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true module Contrast module Components # A wrapper build around the Common Agent Configuration project to allow # for access of the values contained in its # parent_configuration_spec.yaml. # Specifically, this allows for querying the state of the Application, # including the Client, Process, and Server information. module AppContextExtend SUPPORTED_FRAMEWORKS = %w[rails sinatra grape rack].cs__freeze SUPPORTED_SERVERS = %w[passenger puma thin unicorn].cs__freeze def pid Process.pid end def ppid Process.ppid end def app_and_server_information { application_info: find_gem_information(SUPPORTED_FRAMEWORKS), server_info: find_gem_information(SUPPORTED_SERVERS) } end def find_gem_information arr arr.each do |framework| next unless Gem.loaded_specs.key?(framework) loaded = Gem.loaded_specs[framework] next unless loaded name = loaded.instance_variable_get(:@name) version = loaded.instance_variable_get(:@version).to_s return [name, version].join(' ') end nil end def instrument_middleware_stack? !Contrast::Utils::JobServersRunning.job_servers_running? end def disabled_agent_rake_tasks ::Contrast::CONFIG.agent.ruby.disabled_agent_rake_tasks end end end end
Version data entries
4 entries across 4 versions & 1 rubygems