# 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 include Contrast::Config::BaseConfiguration # @return [Boolean, nil] attr_accessor :enable # @return [Boolean, nil] attr_accessor :omit_body # @return [Contrast::Config::RubyConfiguration] attr_writer :ruby # @return [Contrast::Config::ServiceConfiguration] attr_writer :service # @return [ Contrast::Config::LoggerConfiguration] attr_writer :logger # @return [Contrast::Config::HeapDumpConfiguration] attr_writer :heap_dump def initialize hsh = {} return unless hsh @enable = hsh[:enable] @start_bundled_service = hsh[:start_bundled_service] @omit_body = hsh[:omit_body] @service = Contrast::Config::ServiceConfiguration.new(hsh[:service]) @logger = Contrast::Config::LoggerConfiguration.new(hsh[:logger]) @ruby = Contrast::Config::RubyConfiguration.new(hsh[:ruby]) @heap_dump = Contrast::Config::HeapDumpConfiguration.new(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