()
| 218 | } |
| 219 | |
| 220 | func (t *App) initOverridesAPI() (services.Service, error) { |
| 221 | cfg := t.cfg.Overrides.UserConfigurableOverridesConfig |
| 222 | |
| 223 | if !cfg.Enabled { |
| 224 | return services.NewIdleService(nil, nil), nil |
| 225 | } |
| 226 | |
| 227 | userConfigOverridesAPI, err := userconfigurableoverridesapi.New(&cfg.API, &cfg.Client, t.Overrides, newOverridesValidator(&t.cfg)) |
| 228 | if err != nil { |
| 229 | return nil, fmt.Errorf("failed to create user-configurable overrides API: %w", err) |
| 230 | } |
| 231 | |
| 232 | overridesPath := addHTTPAPIPrefix(&t.cfg, api.PathOverrides) |
| 233 | wrapHandler := func(h http.HandlerFunc) http.Handler { |
| 234 | return t.HTTPAuthMiddleware.Wrap(h) |
| 235 | } |
| 236 | |
| 237 | t.Server.HTTPRouter().Path(overridesPath).Methods(http.MethodGet).Handler(wrapHandler(userConfigOverridesAPI.GetHandler)) |
| 238 | t.Server.HTTPRouter().Path(overridesPath).Methods(http.MethodPost).Handler(wrapHandler(userConfigOverridesAPI.PostHandler)) |
| 239 | t.Server.HTTPRouter().Path(overridesPath).Methods(http.MethodPatch).Handler(wrapHandler(userConfigOverridesAPI.PatchHandler)) |
| 240 | t.Server.HTTPRouter().Path(overridesPath).Methods(http.MethodDelete).Handler(wrapHandler(userConfigOverridesAPI.DeleteHandler)) |
| 241 | |
| 242 | return userConfigOverridesAPI, nil |
| 243 | } |
| 244 | |
| 245 | func (t *App) initDistributor() (services.Service, error) { |
| 246 | singleBinary := IsSingleBinary(t.cfg.Target) |
nothing calls this directly
no test coverage detected