MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / extractSecurityConfig

Function extractSecurityConfig

agent/app/service/agents_utils.go:164–183  ·  view source on GitHub ↗
(conf map[string]interface{})

Source from the content-addressed store, hash-verified

162}
163
164func extractSecurityConfig(conf map[string]interface{}) dto.AgentSecurityConfig {
165 result := dto.AgentSecurityConfig{AllowedOrigins: []string{}}
166 gateway, ok := conf["gateway"].(map[string]interface{})
167 if !ok {
168 return result
169 }
170 controlUi, ok := gateway["controlUi"].(map[string]interface{})
171 if !ok {
172 return result
173 }
174 switch values := controlUi["allowedOrigins"].(type) {
175 case []interface{}:
176 for _, value := range values {
177 if text, ok := value.(string); ok && strings.TrimSpace(text) != "" {
178 result.AllowedOrigins = append(result.AllowedOrigins, strings.TrimSpace(text))
179 }
180 }
181 }
182 return result
183}
184
185func setSecurityConfig(conf map[string]interface{}, config dto.AgentSecurityConfig) {
186 ensureGatewaySecurityDefaults(conf)

Calls

no outgoing calls

Tested by

no test coverage detected