Module: Datadog::AIGuard::Configuration::Settings
- Included in:
- Core::Configuration::Settings
- Defined in:
- lib/datadog/ai_guard/configuration/settings.rb
Overview
AI Guard specific settings
Class Method Summary collapse
Class Method Details
.add_settings!(base) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/datadog/ai_guard/configuration/settings.rb', line 16 def self.add_settings!(base) base.class_eval do # AI Guard specific configurations. # @public_api settings :ai_guard do # Enable AI Guard. # # You can use this option to skip calls to AI Guard API without having to remove library as a whole. # # @default `DD_AI_GUARD_ENABLED`, otherwise `false` # @return [Boolean] option :enabled do |o| o.type :bool o.env Ext::ENV_AI_GUARD_ENABLED o.default false end # AI Guard API endpoint path. # # @default `DD_AI_GUARD_ENDPOINT`, otherwise `nil` # @return [String, nil] option :endpoint do |o| o.type :string, nilable: true o.env Ext::ENV_AI_GUARD_ENDPOINT o.setter do |value| next unless value uri = URI(value.to_s) raise ArgumentError, "Please provide an absolute URI that includes a protocol" unless uri.absolute? uri.to_s.delete_suffix("/") end end # Datadog Application key. # # @default `DD_APP_KEY` environment variable, otherwise `nil` # @return [String, nil] option :app_key do |o| o.type :string, nilable: true o.env Ext::ENV_APP_KEY end # Request timeout in milliseconds. # # @default `DD_AI_GUARD_TIMEOUT`, otherwise 10 000 ms # @return [Integer] option :timeout_ms do |o| o.type :int o.env Ext::ENV_AI_GUARD_TIMEOUT o.default 10_000 end # Maximum content size in bytes. # Content that exceeds the maximum allowed size is truncated before # being stored in the current span context. # # @default `DD_AI_GUARD_MAX_CONTENT_SIZE`, otherwise 524 228 bytes # @return [Integer] option :max_content_size_bytes do |o| o.type :int o.env Ext::ENV_AI_GUARD_MAX_CONTENT_SIZE o.default 512 * 1024 end # Maximum number of messages. # Older messages are omitted once the message limit is reached. # # @default `DD_AI_GUARD_MAX_MESSAGES_LENGTH`, otherwise 16 messages # @return [Integer] option :max_messages_length do |o| o.type :int o.env Ext::ENV_AI_GUARD_MAX_MESSAGES_LENGTH o.default 16 end end end end |
.extended(base) ⇒ Object
11 12 13 14 |
# File 'lib/datadog/ai_guard/configuration/settings.rb', line 11 def self.extended(base) base = base.singleton_class unless base.is_a?(Class) add_settings!(base) end |