Sha256: 9233cf0424621a0434ab06d4a121248c7e81214bf8f412624fc5f8dc005966b9

Contents?: true

Size: 1.83 KB

Versions: 1

Compression:

Stored size: 1.83 KB

Contents

# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

require 'contrast/config/service_configuration'
require 'contrast/config/logger_configuration'
require 'contrast/config/ruby_configuration'
require 'contrast/config/heap_dump_configuration'
require 'contrast/config/api_configuration'

module Contrast
  module Config
    # Common Configuration settings. Those in this section pertain to the
    # core functionality of the Agent.
    class AgentConfiguration < BaseConfiguration
      # @return [Boolean, nil]
      attr_accessor :enable
      # @return [Boolean, nil]
      attr_accessor :omit_body
      attr_writer :ruby, :service, :logger, :heap_dump

      def initialize hsh = {}
        @enable = traverse_config(hsh, :enable)
        @start_bundled_service = traverse_config(hsh, :start_bundled_service)
        @omit_body = traverse_config(hsh, :omit_body)
        @service = Contrast::Config::ServiceConfiguration.new(traverse_config(hsh, :service))
        @logger = Contrast::Config::LoggerConfiguration.new(traverse_config(hsh, :logger))
        @ruby = Contrast::Config::RubyConfiguration.new(traverse_config(hsh, :ruby))
        @heap_dump = Contrast::Config::HeapDumpConfiguration.new(traverse_config(hsh, :heap_dump))
      end

      # @return [Boolean, true]
      def start_bundled_service
        @start_bundled_service.nil? ? true : @start_bundled_service
      end

      def service
        @service ||= Contrast::Config::ServiceConfiguration.new
      end

      def logger
        @logger ||= Contrast::Config::LoggerConfiguration.new
      end

      def ruby
        @ruby ||= Contrast::Config::RubyConfiguration.new
      end

      def heap_dump
        @heap_dump ||= Contrast::Config::HeapDumpConfiguration.new
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
contrast-agent-6.0.0 lib/contrast/config/agent_configuration.rb