(conf map[string]interface{})
| 162 | } |
| 163 | |
| 164 | func 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 | |
| 185 | func setSecurityConfig(conf map[string]interface{}, config dto.AgentSecurityConfig) { |
| 186 | ensureGatewaySecurityDefaults(conf) |
no outgoing calls
no test coverage detected