diff --git a/cmd/main.go b/cmd/main.go index dfad696..e887927 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -1,18 +1,28 @@ package main import ( - docs "gitea.d3m0k1d.ru/hellreign/Control-plane/docs" + docs "gitea.d3m0k1d.ru/HellreigN/Control-plane/docs" "github.com/gin-gonic/gin" "github.com/swaggo/files" "github.com/swaggo/gin-swagger" ) +// @securityDefinitions.apikey Bearer +// @in header +// @name Authorization +// @description Type "Bearer" followed by a space and the JWT token. + func main() { r := gin.Default() + docs.SwaggerInfo.Title = "AegisGuard API" + docs.SwaggerInfo.Version = "1.0" + docs.SwaggerInfo.Description = "API for AegisGuard" + docs.SwaggerInfo.Schemes = []string{"http"} + r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) r.GET("/health", func(c *gin.Context) { c.JSON(200, gin.H{ - "message": "OK", + "status": "ok", }) }) - r.Run() + r.Run(":8080") } diff --git a/docs/docs.go b/docs/docs.go index 6676994..a91df67 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -14,7 +14,15 @@ const docTemplate = `{ }, "host": "{{.Host}}", "basePath": "{{.BasePath}}", - "paths": {} + "paths": {}, + "securityDefinitions": { + "Bearer": { + "description": "Type \"Bearer\" followed by a space and the JWT token.", + "type": "apiKey", + "name": "Authorization", + "in": "header" + } + } }` // SwaggerInfo holds exported Swagger Info so clients can modify it diff --git a/docs/swagger.json b/docs/swagger.json index ec416cd..5173354 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -3,5 +3,13 @@ "info": { "contact": {} }, - "paths": {} + "paths": {}, + "securityDefinitions": { + "Bearer": { + "description": "Type \"Bearer\" followed by a space and the JWT token.", + "type": "apiKey", + "name": "Authorization", + "in": "header" + } + } } \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml index b64379c..0dbe493 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1,4 +1,10 @@ info: contact: {} paths: {} +securityDefinitions: + Bearer: + description: Type "Bearer" followed by a space and the JWT token. + in: header + name: Authorization + type: apiKey swagger: "2.0" diff --git a/go.mod b/go.mod index 4b446ee..a6791c5 100644 --- a/go.mod +++ b/go.mod @@ -43,6 +43,8 @@ require ( github.com/quic-go/quic-go v0.60.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect + github.com/swaggo/files v1.0.1 // indirect + github.com/swaggo/gin-swagger v1.6.1 // indirect github.com/swaggo/swag v1.16.6 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.3.1 // indirect