Sha256: ef17647c26015024974959ad1c830d80b423a0a827476811e8f626c4db9378a3

Contents?: true

Size: 974 Bytes

Versions: 3

Compression:

Stored size: 974 Bytes

Contents

# frozen_string_literal: true

require "anyway_config"

module Sniffer
  # Sniffer configuration
  class Config < Anyway::Config
    config_name :sniffer

    attr_config logger: Logger.new($stdout),
                severity: Logger::Severity::DEBUG,
                log: {
                  request_url: true,
                  request_headers: true,
                  request_body: true,
                  request_method: true,
                  response_status: true,
                  response_headers: true,
                  response_body: true,
                  timing: true
                },
                store: true,
                enabled: false,
                url_whitelist: nil,
                url_blacklist: nil

    def capacity?
      store.is_a?(Hash) && store.key?(:capacity)
    end

    def capacity
      store.fetch(:capacity).to_i
    end

    def rotate?
      return false unless capacity?
      store.fetch(:rotate, true)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sniffer-0.3.2 lib/sniffer/config.rb
sniffer-0.3.1 lib/sniffer/config.rb
sniffer-0.3.0 lib/sniffer/config.rb