(cfg map[string]any)
| 324 | } |
| 325 | |
| 326 | func (m configTabModel) parseConfig(cfg map[string]any) []configField { |
| 327 | var fields []configField |
| 328 | |
| 329 | // Server settings |
| 330 | fields = append(fields, configField{"Port", "port", "readonly", fmt.Sprintf("%.0f", getFloat(cfg, "port")), nil}) |
| 331 | fields = append(fields, configField{"Host", "host", "readonly", getString(cfg, "host"), nil}) |
| 332 | fields = append(fields, configField{"Debug", "debug", "bool", fmt.Sprintf("%v", getBool(cfg, "debug")), nil}) |
| 333 | fields = append(fields, configField{"Proxy URL", "proxy-url", "string", getString(cfg, "proxy-url"), nil}) |
| 334 | fields = append(fields, configField{"Request Retry", "request-retry", "int", fmt.Sprintf("%.0f", getFloat(cfg, "request-retry")), nil}) |
| 335 | fields = append(fields, configField{"Max Retry Interval (s)", "max-retry-interval", "int", fmt.Sprintf("%.0f", getFloat(cfg, "max-retry-interval")), nil}) |
| 336 | fields = append(fields, configField{"Force Model Prefix", "force-model-prefix", "string", getString(cfg, "force-model-prefix"), nil}) |
| 337 | |
| 338 | // Logging |
| 339 | fields = append(fields, configField{"Logging to File", "logging-to-file", "bool", fmt.Sprintf("%v", getBool(cfg, "logging-to-file")), nil}) |
| 340 | fields = append(fields, configField{"Logs Max Total Size (MB)", "logs-max-total-size-mb", "int", fmt.Sprintf("%.0f", getFloat(cfg, "logs-max-total-size-mb")), nil}) |
| 341 | fields = append(fields, configField{"Error Logs Max Files", "error-logs-max-files", "int", fmt.Sprintf("%.0f", getFloat(cfg, "error-logs-max-files")), nil}) |
| 342 | fields = append(fields, configField{"Usage Stats Enabled", "usage-statistics-enabled", "bool", fmt.Sprintf("%v", getBool(cfg, "usage-statistics-enabled")), nil}) |
| 343 | fields = append(fields, configField{"Request Log", "request-log", "bool", fmt.Sprintf("%v", getBool(cfg, "request-log")), nil}) |
| 344 | |
| 345 | // Quota exceeded |
| 346 | fields = append(fields, configField{"Switch Project on Quota", "quota-exceeded/switch-project", "bool", fmt.Sprintf("%v", getBoolNested(cfg, "quota-exceeded", "switch-project")), nil}) |
| 347 | fields = append(fields, configField{"Switch Preview Model", "quota-exceeded/switch-preview-model", "bool", fmt.Sprintf("%v", getBoolNested(cfg, "quota-exceeded", "switch-preview-model")), nil}) |
| 348 | |
| 349 | // Routing |
| 350 | if routing, ok := cfg["routing"].(map[string]any); ok { |
| 351 | fields = append(fields, configField{"Routing Strategy", "routing/strategy", "string", getString(routing, "strategy"), nil}) |
| 352 | } else { |
| 353 | fields = append(fields, configField{"Routing Strategy", "routing/strategy", "string", "", nil}) |
| 354 | } |
| 355 | |
| 356 | // WebSocket auth |
| 357 | fields = append(fields, configField{"WebSocket Auth", "ws-auth", "bool", fmt.Sprintf("%v", getBool(cfg, "ws-auth")), nil}) |
| 358 | |
| 359 | return fields |
| 360 | } |
| 361 | |
| 362 | func fieldSection(apiPath string) string { |
| 363 | if strings.HasPrefix(apiPath, "quota-exceeded/") { |
no test coverage detected