This commit is contained in:
2023-08-05 18:02:45 -05:00
parent 6f6872eaba
commit b98b87e4ba
6 changed files with 32 additions and 5 deletions

View File

@@ -1,3 +1,4 @@
{{ -if .Values.ingress.enabled }}
apiVersion: traefik.containo.us/v1alpha1 apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute kind: IngressRoute
metadata: metadata:
@@ -31,3 +32,4 @@ spec:
commonName: {{ .Values.ingress.host }} commonName: {{ .Values.ingress.host }}
dnsNames: dnsNames:
- {{ .Values.ingress.host }} - {{ .Values.ingress.host }}
{{ end }}

View File

@@ -8,6 +8,7 @@ deployment:
maxReplicas: 10 maxReplicas: 10
ingress: ingress:
enabled: false
clusterissuer: letsencrypt-production clusterissuer: letsencrypt-production
host: durpapi.durp.info host: durpapi.durp.info
tls: durpapi-tls tls: durpapi-tls

View File

@@ -333,6 +333,13 @@ const docTemplate = `{
} }
} }
} }
},
"securityDefinitions": {
"ApiKeyAuth": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
} }
}` }`
@@ -340,12 +347,14 @@ const docTemplate = `{
var SwaggerInfo = &swag.Spec{ var SwaggerInfo = &swag.Spec{
Version: "", Version: "",
Host: "", Host: "",
BasePath: "/api/v1", BasePath: "/api",
Schemes: []string{}, Schemes: []string{},
Title: "DurpAPI", Title: "DurpAPI",
Description: "API for Durp's needs", Description: "API for Durp's needs",
InfoInstanceName: "swagger", InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate, SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
} }
func init() { func init() {

View File

@@ -14,7 +14,7 @@
"url": "http://www.apache.org/licenses/LICENSE-2.0.html" "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
} }
}, },
"basePath": "/api/v1", "basePath": "/api",
"paths": { "paths": {
"/health/getHealth": { "/health/getHealth": {
"get": { "get": {
@@ -324,5 +324,12 @@
} }
} }
} }
},
"securityDefinitions": {
"ApiKeyAuth": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
} }
} }

View File

@@ -1,4 +1,4 @@
basePath: /api/v1 basePath: /api
definitions: definitions:
model.Message: model.Message:
properties: properties:
@@ -214,4 +214,9 @@ paths:
summary: Unraid PSU Stats summary: Unraid PSU Stats
tags: tags:
- unraid - unraid
securityDefinitions:
ApiKeyAuth:
in: header
name: Authorization
type: apiKey
swagger: "2.0" swagger: "2.0"

View File

@@ -32,7 +32,10 @@ var groupsenv = os.Getenv("groups")
// @license.name Apache 2.0 // @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html // @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() { func main() {
r := gin.Default() r := gin.Default()
@@ -41,7 +44,7 @@ func main() {
docs.SwaggerInfo.Host = c.Cfg.Host docs.SwaggerInfo.Host = c.Cfg.Host
docs.SwaggerInfo.Version = c.Cfg.Version docs.SwaggerInfo.Version = c.Cfg.Version
v1 := r.Group("/api/v1") v1 := r.Group("/api")
{ {
health := v1.Group("/health") health := v1.Group("/health")
{ {