Sha256: e3611e278640973f6ba54e57e85db153a2393b041d650153bf9fc2f95efbc1f1
Contents?: true
Size: 1.64 KB
Versions: 5
Compression:
Stored size: 1.64 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 Components module SecurityLogger # Here we will read and store the setting for the CEF Logging functionality class Interface include Contrast::Components::ComponentBase DEFAULT_CEF_NAME = 'security.log' CANON_NAME = 'agent.security_logger' CONFIG_VALUES = %w[path level].cs__freeze # @return [String, nil] attr_accessor :path # @return [String, nil] attr_accessor :level # @return [String] attr_reader :canon_name # @return [Array] attr_reader :config_values def initialize hsh = {} @config_values = CONFIG_VALUES @canon_name = CANON_NAME return unless hsh @path = hsh[:path] @level = hsh[:level] end def to_effective_config effective_config path_setting = nil level_setting = nil if defined?(Contrast::SETTINGS) path_setting = Contrast::SETTINGS.agent_state.cef_logger_path level_setting = Contrast::SETTINGS.agent_state.cef_logger_level end path_setting ||= DEFAULT_CEF_NAME level_setting ||= Contrast::CONFIG.agent.logger.level add_single_effective_value(effective_config, config_values[0], path || path_setting, CANON_NAME) add_single_effective_value(effective_config, config_values[1], level || level_setting, CANON_NAME) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems