kojiapi: prefix all routes with /api/composer-koji/v1

The cloud API will be moved to `/api/composer/v1` in the future.

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 22:27:48 +02:00 committed by Tom Gundersen
parent a8ba969f6e
commit 40d8440660
5 changed files with 11 additions and 7 deletions

View file

@ -1,3 +1,5 @@
//go:generate go run github.com/deepmap/oapi-codegen/cmd/oapi-codegen -package=api -generate types,server -o api.gen.go openapi.yml
package api
const BasePath = "/api/composer-koji/v1"

View file

@ -1,11 +1,13 @@
openapi: 3.0.1
info:
version: '1'
title: OSBuild Composer - Koji
version: '1'
description: Service to build and push images to Koji.
license:
name: Apache 2.0
url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
servers:
- url: /api/composer-koji/v1
paths:
/status:
get:

View file

@ -44,7 +44,7 @@ func NewServer(logger *log.Logger, workers *worker.Server, rpmMetadata rpmmd.RPM
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,