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) ⇒ Object
-
#initialize ⇒ CorsConfig
constructor
A new instance of CorsConfig.
Constructor Details
#initialize ⇒ CorsConfig
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
#enabled ⇒ Object
Returns the value of attribute enabled.
136 137 138 |
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 136 def enabled @enabled end |
#headers ⇒ Object
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_age ⇒ Object
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 |
#methods ⇒ Object
Returns the value of attribute methods.
136 137 138 |
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 136 def methods @methods end |
#origins ⇒ Object
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 |