worker: prefix all routes with /api/worker/v1

Mention this in the `servers` section of the openapi.yml (relative URLs
are allowed) too, even though our generator does not consider it.
This commit is contained in:
Lars Karlitski 2020-09-23 15:57:55 +02:00 committed by Tom Gundersen
parent 9008a1defc
commit a8ba969f6e
6 changed files with 35 additions and 21 deletions

View file

@ -65,7 +65,7 @@ func NewServer(logger *log.Logger, jobs jobqueue.JobQueue, artifactsDir string)
e.Binder = binder{}
e.StdLogger = logger
api.RegisterHandlers(e, &apiHandlers{s})
api.RegisterHandlers(e.Group(api.BasePath), &apiHandlers{s})
s.server = &http.Server{
ErrorLog: logger,
@ -277,8 +277,8 @@ func (h *apiHandlers) RequestJob(ctx echo.Context) error {
return ctx.JSON(http.StatusCreated, requestJobResponse{
Id: jobId,
Location: fmt.Sprintf("/jobs/%v", token),
ArtifactLocation: fmt.Sprintf("/jobs/%v/artifacts/", token),
Location: fmt.Sprintf("%s/jobs/%v", api.BasePath, token),
ArtifactLocation: fmt.Sprintf("%s/jobs/%v/artifacts/", api.BasePath, token),
Type: "osbuild",
Args: serializedArgs,
})