Class: RosettAi::Mcp::HttpSecurityConfig::CorsConfig
- Inherits:
-
Object
- Object
- RosettAi::Mcp::HttpSecurityConfig::CorsConfig
- Defined in:
- lib/rosett_ai/mcp/http_security_config.rb
Overview
CORS sub-configuration.
Instance Attribute Summary collapse
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#max_age ⇒ Object
Returns the value of attribute max_age.
-
#methods ⇒ Object
Returns the value of attribute methods.
-
#origins ⇒ Object
Returns the value of attribute origins.
Instance Method Summary collapse
-
#apply(hash) ⇒ void
Apply CORS configuration from a hash.
-
#initialize ⇒ CorsConfig
constructor
A new instance of CorsConfig.
Constructor Details
#initialize ⇒ CorsConfig
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
#enabled ⇒ Object
Returns the value of attribute enabled.
154 155 156 |
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 154 def enabled @enabled end |
#headers ⇒ Object
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_age ⇒ Object
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 |
#methods ⇒ Object
Returns the value of attribute methods.
154 155 156 |
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 154 def methods @methods end |
#origins ⇒ Object
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.
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 |