expandConfigPlaceholders substitutes the five recognised placeholders. It is a superset of expandPlaceholders in launch.go (adds {endpoint_name} and {model_2}; model_2 is empty until callers thread a secondary model in).
(raw string, ep providers.Endpoint, endpointName, model, apiKey string)
| 62 | // is a superset of expandPlaceholders in launch.go (adds {endpoint_name} and |
| 63 | // {model_2}; model_2 is empty until callers thread a secondary model in). |
| 64 | func expandConfigPlaceholders(raw string, ep providers.Endpoint, endpointName, model, apiKey string) string { |
| 65 | s := raw |
| 66 | s = strings.ReplaceAll(s, "{endpoint}", ep.Endpoint) |
| 67 | s = strings.ReplaceAll(s, "{endpoint_name}", endpointName) |
| 68 | s = strings.ReplaceAll(s, "{api_key_env}", providers.ResolveAPIKeyEnv(ep, endpointName)) |
| 69 | s = strings.ReplaceAll(s, "{api_key}", apiKey) |
| 70 | s = strings.ReplaceAll(s, "{selected_model}", model) |
| 71 | s = strings.ReplaceAll(s, "{model_2}", "") |
| 72 | return s |
| 73 | } |
| 74 | |
| 75 | // coerceScalar promotes a raw string into the most specific Go type that fits. |
| 76 | // Order: bool > int64 > float64 > string. Reuses editorconfig.ParseScalar |
no test coverage detected