Sha256: 5372629e78023169fe76a05c214051466901f13121a0e0e275960e04ef7378c8

Contents?: true

Size: 1.32 KB

Versions: 3

Compression:

Stored size: 1.32 KB

Contents

# frozen_string_literal: true

require_relative 'appsec/configuration'
require_relative 'appsec/extensions'
require_relative 'appsec/scope'
require_relative 'appsec/ext'

module Datadog
  # Namespace for Datadog AppSec instrumentation
  module AppSec
    class << self
      def enabled?
        Datadog.configuration.appsec.enabled
      end

      def active_scope
        Datadog::AppSec::Scope.active_scope
      end

      def processor
        appsec_component = components.appsec

        appsec_component.processor if appsec_component
      end

      def reconfigure(ruleset:)
        appsec_component = components.appsec

        return unless appsec_component

        appsec_component.reconfigure(ruleset: ruleset)
      end

      def reconfigure_lock(&block)
        appsec_component = components.appsec

        return unless appsec_component

        appsec_component.reconfigure_lock(&block)
      end

      private

      def components
        Datadog.send(:components)
      end
    end

    # Expose AppSec to global shared objects
    Extensions.activate!
  end
end

# Integrations
require_relative 'appsec/contrib/rack/integration'
require_relative 'appsec/contrib/sinatra/integration'
require_relative 'appsec/contrib/rails/integration'
require_relative 'appsec/contrib/devise/integration'

require_relative 'appsec/autoload'

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ddtrace-1.14.0 lib/datadog/appsec.rb
ddtrace-1.13.1 lib/datadog/appsec.rb
ddtrace-1.13.0 lib/datadog/appsec.rb