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.



138
139
140
141
142
143
144
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 138

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.



136
137
138
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 136

def enabled
  @enabled
end

#headersObject

Returns the value of attribute headers.



136
137
138
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 136

def headers
  @headers
end

#max_ageObject

Returns the value of attribute max_age.



136
137
138
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 136

def max_age
  @max_age
end

#methodsObject

Returns the value of attribute methods.



136
137
138
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 136

def methods
  @methods
end

#originsObject

Returns the value of attribute origins.



136
137
138
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 136

def origins
  @origins
end

Instance Method Details

#apply(hash) ⇒ Object



146
147
148
149
150
151
152
153
154
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 146

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