Setup swagger and swagger UI properly

This commit is contained in:
Kristoffer Dalby
2021-10-30 14:29:53 +00:00
parent 2b340e8fa4
commit 482a31b66b
2 changed files with 67 additions and 2 deletions

4
app.go
View File

@@ -381,8 +381,8 @@ func (h *Headscale) Serve() error {
r.POST("/machine/:id", h.RegistrationHandler)
r.GET("/apple", h.AppleMobileConfig)
r.GET("/apple/:platform", h.ApplePlatformConfig)
r.StaticFile("/swagger/swagger.json", "gen/openapiv2/v1/headscale.swagger.json")
r.GET("/swagger", SwaggerUI)
r.GET("/swagger/v1/openapiv2.json", SwaggerAPIv1)
api := r.Group("/api")
api.Use(h.httpAuthenticationMiddleware)