Sha256: 5953a7a1dbdd0ebfdc4c482af6d94e25f71627c709880ebb76051df44a2a8af0
Contents?: true
Size: 1.52 KB
Versions: 2
Compression:
Stored size: 1.52 KB
Contents
# typed: true require 'datadog/appsec/configuration/settings' module Datadog module AppSec # Configuration for AppSec # TODO: this is a trivial implementation, check with shareable code with # tracer and other products module Configuration def self.included(base) base.extend(ClassMethods) end # Configuration DSL implementation class DSL Instrument = Struct.new(:name, :options) def initialize @instruments = [] @options = {} end attr_reader :instruments, :options def instrument(name, options = {}) @instruments << Instrument.new(name, options) end def enabled=(value) options[:enabled] = value end def ruleset=(value) options[:ruleset] = value end # in microseconds def waf_timeout=(value) options[:waf_timeout] = value end def waf_debug=(value) options[:waf_debug] = value end def trace_rate_limit=(value) options[:trace_rate_limit] = value end def [](key) found = @instruments.find { |e| e.name == key } found.options if found end end # class-level methods for Configuration module ClassMethods def configure dsl = DSL.new yield dsl settings.merge(dsl) settings end def settings @settings ||= Settings.new end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ddtrace-1.0.0 | lib/datadog/appsec/configuration.rb |
ddtrace-1.0.0.beta2 | lib/datadog/appsec/configuration.rb |