(app *application.Application)
| 233 | } |
| 234 | |
| 235 | func buildMITMStatus(app *application.Application) map[string]any { |
| 236 | srv := app.MITMServer() |
| 237 | ca := app.MITMCA() |
| 238 | cfg := app.ApplicationConfig() |
| 239 | |
| 240 | // MITM-bound model configs — anything with an mitm: block, even |
| 241 | // if hosts is empty. Surfaces a "fresh from template" config the |
| 242 | // admin started but hasn't yet attached a host to. |
| 243 | mitmModels := []map[string]any{} |
| 244 | for _, mc := range app.ModelConfigLoader().GetModelConfigsByFilter(func(_ string, c *config.ModelConfig) bool { |
| 245 | return len(c.MITM.Hosts) > 0 |
| 246 | }) { |
| 247 | mitmModels = append(mitmModels, map[string]any{ |
| 248 | "name": mc.Name, |
| 249 | "hosts": mc.MITM.Hosts, |
| 250 | "pii_enabled": mc.PIIIsEnabled(), |
| 251 | "backend": mc.Backend, |
| 252 | }) |
| 253 | } |
| 254 | |
| 255 | out := map[string]any{ |
| 256 | "running": srv != nil, |
| 257 | "listen_addr": "", |
| 258 | "configured_addr": cfg.MITMListen, |
| 259 | "host_owners": app.MITMHostOwners(), |
| 260 | "host_conflicts": app.MITMHostConflicts(), |
| 261 | "models": mitmModels, |
| 262 | "ca_available": ca != nil, |
| 263 | "ca_cert_url": "", |
| 264 | } |
| 265 | if conflicts := app.MITMHostConflicts(); len(conflicts) > 0 { |
| 266 | out["error"] = "MITM listener disabled: duplicate host claims across model configs (see host_conflicts). Resolve by editing the conflicting model YAMLs so each host appears in at most one mitm.hosts list." |
| 267 | } |
| 268 | if srv != nil { |
| 269 | out["listen_addr"] = srv.Addr() |
| 270 | } |
| 271 | if ca != nil { |
| 272 | out["ca_cert_url"] = "/api/middleware/proxy-ca.crt" |
| 273 | } |
| 274 | return out |
| 275 | } |
| 276 | |
| 277 | // buildAdmissionStatus reports each model's MaxConcurrent ceiling |
| 278 | // and current in-flight count. Models with no limit set are |
no test coverage detected