From b98b87e4bac56481320e16ddf3a05371981fbf25 Mon Sep 17 00:00:00 2001 From: DeveloperDurp Date: Sat, 5 Aug 2023 18:02:45 -0500 Subject: [PATCH] update --- charts/durpapi/templates/ingress.yaml | 2 ++ charts/durpapi/values.yaml | 1 + docs/docs.go | 11 ++++++++++- docs/swagger.json | 9 ++++++++- docs/swagger.yaml | 7 ++++++- main.go | 7 +++++-- 6 files changed, 32 insertions(+), 5 deletions(-) diff --git a/charts/durpapi/templates/ingress.yaml b/charts/durpapi/templates/ingress.yaml index 7021ee6..0331ee1 100644 --- a/charts/durpapi/templates/ingress.yaml +++ b/charts/durpapi/templates/ingress.yaml @@ -1,3 +1,4 @@ +{{ -if .Values.ingress.enabled }} apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: @@ -31,3 +32,4 @@ spec: commonName: {{ .Values.ingress.host }} dnsNames: - {{ .Values.ingress.host }} +{{ end }} \ No newline at end of file diff --git a/charts/durpapi/values.yaml b/charts/durpapi/values.yaml index c8573b4..c25304f 100644 --- a/charts/durpapi/values.yaml +++ b/charts/durpapi/values.yaml @@ -8,6 +8,7 @@ deployment: maxReplicas: 10 ingress: + enabled: false clusterissuer: letsencrypt-production host: durpapi.durp.info tls: durpapi-tls diff --git a/docs/docs.go b/docs/docs.go index 6417b9b..02a74a8 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -333,6 +333,13 @@ const docTemplate = `{ } } } + }, + "securityDefinitions": { + "ApiKeyAuth": { + "type": "apiKey", + "name": "Authorization", + "in": "header" + } } }` @@ -340,12 +347,14 @@ const docTemplate = `{ var SwaggerInfo = &swag.Spec{ Version: "", Host: "", - BasePath: "/api/v1", + BasePath: "/api", Schemes: []string{}, Title: "DurpAPI", Description: "API for Durp's needs", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, + LeftDelim: "{{", + RightDelim: "}}", } func init() { diff --git a/docs/swagger.json b/docs/swagger.json index c4f0d91..46a4a9c 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -14,7 +14,7 @@ "url": "http://www.apache.org/licenses/LICENSE-2.0.html" } }, - "basePath": "/api/v1", + "basePath": "/api", "paths": { "/health/getHealth": { "get": { @@ -324,5 +324,12 @@ } } } + }, + "securityDefinitions": { + "ApiKeyAuth": { + "type": "apiKey", + "name": "Authorization", + "in": "header" + } } } \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml index d55001f..a768253 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1,4 +1,4 @@ -basePath: /api/v1 +basePath: /api definitions: model.Message: properties: @@ -214,4 +214,9 @@ paths: summary: Unraid PSU Stats tags: - unraid +securityDefinitions: + ApiKeyAuth: + in: header + name: Authorization + type: apiKey swagger: "2.0" diff --git a/main.go b/main.go index f522e4e..f310684 100644 --- a/main.go +++ b/main.go @@ -32,7 +32,10 @@ var groupsenv = os.Getenv("groups") // @license.name Apache 2.0 // @license.url http://www.apache.org/licenses/LICENSE-2.0.html -// @BasePath /api/v1 +// @BasePath /api +// @securityDefinitions.apikey ApiKeyAuth +// @in header +// @name Authorization func main() { r := gin.Default() @@ -41,7 +44,7 @@ func main() { docs.SwaggerInfo.Host = c.Cfg.Host docs.SwaggerInfo.Version = c.Cfg.Version - v1 := r.Group("/api/v1") + v1 := r.Group("/api") { health := v1.Group("/health") {