Class: RosettAi::Mcp::HttpSecurityConfig::CorsConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/rosett_ai/mcp/http_security_config.rb

Overview

CORS sub-configuration.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCorsConfig

Returns a new instance of CorsConfig.



156
157
158
159
160
161
162
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 156

def initialize
  @enabled = false
  @origins = []
  @methods = ['POST', 'GET', 'DELETE']
  @headers = ['Content-Type', 'Authorization', 'Accept', 'Mcp-Session-Id']
  @max_age = 86_400
end

Instance Attribute Details

#enabledObject

Returns the value of attribute enabled.



154
155
156
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 154

def enabled
  @enabled
end

#headersObject

Returns the value of attribute headers.



154
155
156
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 154

def headers
  @headers
end

#max_ageObject

Returns the value of attribute max_age.



154
155
156
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 154

def max_age
  @max_age
end

#methodsObject

Returns the value of attribute methods.



154
155
156
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 154

def methods
  @methods
end

#originsObject

Returns the value of attribute origins.



154
155
156
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 154

def origins
  @origins
end

Instance Method Details

#apply(hash) ⇒ void

This method returns an undefined value.

Apply CORS configuration from a hash.

Parameters:

  • hash (Hash)

    configuration values



168
169
170
171
172
173
174
175
176
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 168

def apply(hash)
  return unless hash.is_a?(Hash)

  @enabled = hash['enabled'] if hash.key?('enabled')
  @origins = hash['origins'] if hash['origins']
  @methods = hash['methods'] if hash['methods']
  @headers = hash['headers'] if hash['headers']
  @max_age = hash['max_age'] if hash['max_age']
end