Sha256: a2c5187fd40d554bdeca41419265f695e05285892ce379740e9cefa4d9f57513

Contents?: true

Size: 1.48 KB

Versions: 6

Compression:

Stored size: 1.48 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/logger_configuration'

module Contrast
  module Config
    # Common Configuration settings. Those in this section pertain to the communication between the Agent & the Service
    class ServiceConfiguration
      include Contrast::Config::BaseConfiguration

      # We don't set these b/c we've been asked to handle the default values of these settings differently, logging
      # when we have to use them.
      DEFAULT_HOST       = '127.0.0.1' # rubocop:disable Style/IpAddresses
      DEFAULT_PORT       = '30555'

      attr_writer :logger, :bypass
      # @return [String, nil]
      attr_accessor :socket
      # @return [String, nil]
      attr_accessor :port
      # @return [String, nil]
      attr_accessor :host
      # @return [Boolean, nil]
      attr_accessor :enable

      def initialize hsh = {}
        return unless hsh

        @enable = hsh[:enable]
        @host = hsh[:host]
        @port = hsh[:port]
        @socket = hsh[:socket]
        @logger = Contrast::Config::LoggerConfiguration.new(hsh[:logger])
        @bypass = hsh[:bypass]
      end

      # @return [Contrast::Config::LoggerConfiguration]
      def logger
        @logger ||= Contrast::Config::LoggerConfiguration.new
      end

      # @return [Boolean, false]
      def bypass
        @bypass.nil? ? false : @bypass
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
contrast-agent-6.4.0 lib/contrast/config/service_configuration.rb
contrast-agent-6.3.0 lib/contrast/config/service_configuration.rb
contrast-agent-6.2.0 lib/contrast/config/service_configuration.rb
contrast-agent-6.1.2 lib/contrast/config/service_configuration.rb
contrast-agent-6.1.1 lib/contrast/config/service_configuration.rb
contrast-agent-6.1.0 lib/contrast/config/service_configuration.rb