Sha256: 923fdf7fbc43bb49897ff8a525b8a2b1039278c0faf4ffb576766a2adb02b597

Contents?: true

Size: 1.42 KB

Versions: 8

Compression:

Stored size: 1.42 KB

Contents

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

require 'contrast/components/base'

module Contrast
  module Config
    # Certificate Configuration
    class CertificationConfiguration
      include Contrast::Config::BaseConfiguration
      include Contrast::Components::ComponentBase

      CANON_NAME = 'api.certification'
      CONFIG_VALUES = %w[ca_file cert_file key_file enable].cs__freeze

      # @return [String] path to CA Cert file
      attr_accessor :ca_file
      # @return [String] path to Certification file
      attr_accessor :cert_file
      # @return [String] path to Certification Key file
      attr_accessor :key_file
      attr_writer :enable

      def initialize hsh = {}
        return unless hsh

        @enable = hsh[:enable]
        @ca_file = hsh[:ca_file]
        @cert_file = hsh[:cert_file]
        @key_file = hsh[:key_file]
      end

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

      # Converts current configuration to effective config values class and appends them to
      # EffectiveConfig class.
      #
      # @param effective_config [Contrast::Agent::DiagnosticsConfig::EffectiveConfig]
      def to_effective_config effective_config
        add_effective_config_values(effective_config, CONFIG_VALUES, CANON_NAME, CONTRAST)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
contrast-agent-7.0.0 lib/contrast/config/certification_configuration.rb
contrast-agent-6.15.3 lib/contrast/config/certification_configuration.rb
contrast-agent-6.15.2 lib/contrast/config/certification_configuration.rb
contrast-agent-6.15.1 lib/contrast/config/certification_configuration.rb
contrast-agent-6.15.0 lib/contrast/config/certification_configuration.rb
contrast-agent-6.14.0 lib/contrast/config/certification_configuration.rb
contrast-agent-6.13.0 lib/contrast/config/certification_configuration.rb
contrast-agent-6.12.0 lib/contrast/config/certification_configuration.rb