go #49

Merged
niggl merged 96 commits from go into main 2024-12-12 15:11:31 +00:00
4 changed files with 37 additions and 2 deletions
Showing only changes of commit 1dfd96869d - Show all commits

View File

@ -320,7 +320,19 @@ const docTemplate = `{
}
}
}
}
},
"securityDefinitions": {
"ApiKeyAuth": {
"type": "apiKey",
"name": "key",
"in": "query"
}
},
"security": [
{
"ApiKeyAuth": []
}
]
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it

View File

@ -311,5 +311,17 @@
}
}
}
}
},
"securityDefinitions": {
"ApiKeyAuth": {
"type": "apiKey",
"name": "key",
"in": "query"
}
},
"security": [
{
"ApiKeyAuth": []
}
]
}

View File

@ -211,4 +211,11 @@ paths:
summary: Generate a contract
tags:
- contracts
security:
- ApiKeyAuth: []
securityDefinitions:
ApiKeyAuth:
in: query
name: key
type: apiKey
swagger: "2.0"

View File

@ -57,6 +57,9 @@ func loadEnv() error {
// @title LfK Document Server API
// @description This is the API documentation for the LfK Document Server - a tool for pdf generation.
// @securityDefinitions.apiKey ApiKeyAuth
// @in query
// @name key
func main() {
err := loadEnv()
@ -76,6 +79,7 @@ func main() {
// Swagger documentation route
app.Get("/swagger/*", swagger.HandlerDefault)
// @Security ApiKeyAuth
v1 := app.Group("/v1")
v1.Use(keyauth.New(keyauth.Config{
KeyLookup: "query:key",