Add frontend #1
@@ -60,7 +60,7 @@ func validateCustomHeaders(customHeaders *models.CustomHeaders) error {
|
||||
//
|
||||
// @Summary List forward rules for a site
|
||||
// @Description Returns all forward rules associated with the given site
|
||||
// @Tags forward-rules
|
||||
// @Tags Forward-Rules
|
||||
// @Produce json
|
||||
// @Param id path string true "Site ID"
|
||||
// @Success 200 {array} models.ForwardRule "List of forward rules"
|
||||
@@ -89,7 +89,7 @@ func (h *SiteHandler) GetSiteForwardRules(c fiber.Ctx) error {
|
||||
//
|
||||
// @Summary Get a forward rule
|
||||
// @Description Returns a single forward rule by ID
|
||||
// @Tags forward-rules
|
||||
// @Tags Forward-Rules
|
||||
// @Produce json
|
||||
// @Param id path string true "Forward Rule ID"
|
||||
// @Success 200 {object} models.ForwardRule "Forward rule"
|
||||
@@ -115,7 +115,7 @@ func (h *SiteHandler) GetForwardRule(c fiber.Ctx) error {
|
||||
//
|
||||
// @Summary Create a forward rule
|
||||
// @Description Creates a new forward rule for the given site
|
||||
// @Tags forward-rules
|
||||
// @Tags Forward-Rules
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Site ID"
|
||||
@@ -158,7 +158,7 @@ func (h *SiteHandler) PostForwardRule(c fiber.Ctx) error {
|
||||
//
|
||||
// @Summary Update a forward rule
|
||||
// @Description Replaces an existing forward rule by ID
|
||||
// @Tags forward-rules
|
||||
// @Tags Forward-Rules
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Forward Rule ID"
|
||||
@@ -208,7 +208,7 @@ func (h *SiteHandler) PutForwardRule(c fiber.Ctx) error {
|
||||
//
|
||||
// @Summary Delete a forward rule
|
||||
// @Description Deletes a forward rule by ID
|
||||
// @Tags forward-rules
|
||||
// @Tags Forward-Rules
|
||||
// @Produce json
|
||||
// @Param id path string true "Forward Rule ID"
|
||||
// @Success 204 "No content"
|
||||
@@ -238,7 +238,7 @@ func (h *SiteHandler) DeleteForwardRule(c fiber.Ctx) error {
|
||||
//
|
||||
// @Summary List custom header groups for a site
|
||||
// @Description Returns all custom header groups associated with the given site
|
||||
// @Tags custom-headers
|
||||
// @Tags Custom-Headers
|
||||
// @Produce json
|
||||
// @Param id path string true "Site ID"
|
||||
// @Success 200 {array} models.CustomHeaders "List of custom header groups"
|
||||
@@ -267,7 +267,7 @@ func (h *SiteHandler) GetSiteCustomHeaders(c fiber.Ctx) error {
|
||||
//
|
||||
// @Summary Get a custom header group
|
||||
// @Description Returns a single custom header group by ID
|
||||
// @Tags custom-headers
|
||||
// @Tags Custom-Headers
|
||||
// @Produce json
|
||||
// @Param id path string true "Custom Headers ID"
|
||||
// @Success 200 {object} models.CustomHeaders "Custom header group"
|
||||
@@ -293,7 +293,7 @@ func (h *SiteHandler) GetCustomHeaders(c fiber.Ctx) error {
|
||||
//
|
||||
// @Summary Create a custom header group
|
||||
// @Description Creates a new custom header group for the given site
|
||||
// @Tags custom-headers
|
||||
// @Tags Custom-Headers
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Site ID"
|
||||
@@ -336,7 +336,7 @@ func (h *SiteHandler) PostCustomHeaders(c fiber.Ctx) error {
|
||||
//
|
||||
// @Summary Update a custom header group
|
||||
// @Description Replaces an existing custom header group by ID
|
||||
// @Tags custom-headers
|
||||
// @Tags Custom-Headers
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Custom Headers ID"
|
||||
@@ -386,7 +386,7 @@ func (h *SiteHandler) PutCustomHeaders(c fiber.Ctx) error {
|
||||
//
|
||||
// @Summary Delete a custom header group
|
||||
// @Description Deletes a custom header group by ID
|
||||
// @Tags custom-headers
|
||||
// @Tags Custom-Headers
|
||||
// @Produce json
|
||||
// @Param id path string true "Custom Headers ID"
|
||||
// @Success 204 "No content"
|
||||
@@ -416,7 +416,7 @@ func (h *SiteHandler) DeleteCustomHeaders(c fiber.Ctx) error {
|
||||
//
|
||||
// @Summary List headers in a custom header group
|
||||
// @Description Returns all individual headers belonging to the given custom header group
|
||||
// @Tags custom-headers
|
||||
// @Tags Custom-Headers
|
||||
// @Produce json
|
||||
// @Param id path string true "Custom Headers ID"
|
||||
// @Success 200 {array} models.Header "List of headers"
|
||||
@@ -445,7 +445,7 @@ func (h *SiteHandler) GetCustomHeaderHeaders(c fiber.Ctx) error {
|
||||
//
|
||||
// @Summary Get a header
|
||||
// @Description Returns a single header by ID
|
||||
// @Tags headers
|
||||
// @Tags Headers
|
||||
// @Produce json
|
||||
// @Param id path string true "Header ID"
|
||||
// @Success 200 {object} models.Header "Header"
|
||||
@@ -471,7 +471,7 @@ func (h *SiteHandler) GetHeader(c fiber.Ctx) error {
|
||||
//
|
||||
// @Summary Create a header
|
||||
// @Description Creates a new header within the given custom header group
|
||||
// @Tags headers
|
||||
// @Tags Headers
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Custom Headers ID"
|
||||
@@ -514,7 +514,7 @@ func (h *SiteHandler) PostHeader(c fiber.Ctx) error {
|
||||
//
|
||||
// @Summary Update a header
|
||||
// @Description Replaces an existing header by ID
|
||||
// @Tags headers
|
||||
// @Tags Headers
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Header ID"
|
||||
@@ -564,7 +564,7 @@ func (h *SiteHandler) PutHeader(c fiber.Ctx) error {
|
||||
//
|
||||
// @Summary Delete a header
|
||||
// @Description Deletes a header by ID
|
||||
// @Tags headers
|
||||
// @Tags Headers
|
||||
// @Produce json
|
||||
// @Param id path string true "Header ID"
|
||||
// @Success 204 "No content"
|
||||
|
||||
@@ -18,7 +18,7 @@ func Register(app *fiber.App, cfg *config.Config, envCfg *envconfig.EnvConfig, d
|
||||
updateSiteHandler := handlers.NewUpdateSiteHandler(cfg, envCfg)
|
||||
siteHandler := handlers.NewSiteHandler(siteRepository)
|
||||
|
||||
api := app.Group("/api")
|
||||
api := app.Group("/api/v1")
|
||||
api.Get("/health", handlers.HealthCheck)
|
||||
|
||||
api.Post("/update", updateSiteHandler.PostUpdate)
|
||||
|
||||
+1095
File diff suppressed because it is too large
Load Diff
+1071
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,707 @@
|
||||
basePath: /api/v1
|
||||
definitions:
|
||||
models.APIError:
|
||||
properties:
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
models.CustomHeaders:
|
||||
properties:
|
||||
headers:
|
||||
items:
|
||||
$ref: '#/definitions/models.Header'
|
||||
type: array
|
||||
id:
|
||||
type: string
|
||||
source:
|
||||
type: string
|
||||
type: object
|
||||
models.ForwardRule:
|
||||
properties:
|
||||
destination:
|
||||
type: string
|
||||
id:
|
||||
type: string
|
||||
regex:
|
||||
type: boolean
|
||||
source:
|
||||
type: string
|
||||
status_code:
|
||||
type: integer
|
||||
type: object
|
||||
models.GetAllSitesResponse:
|
||||
properties:
|
||||
sites:
|
||||
items:
|
||||
$ref: '#/definitions/models.Site'
|
||||
type: array
|
||||
total:
|
||||
type: integer
|
||||
type: object
|
||||
models.Header:
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
key:
|
||||
type: string
|
||||
value:
|
||||
type: string
|
||||
type: object
|
||||
models.Site:
|
||||
properties:
|
||||
branch:
|
||||
type: string
|
||||
custom_headers:
|
||||
items:
|
||||
$ref: '#/definitions/models.CustomHeaders'
|
||||
type: array
|
||||
deploy_token:
|
||||
type: string
|
||||
domain:
|
||||
type: string
|
||||
enabled:
|
||||
type: boolean
|
||||
forward_rules:
|
||||
items:
|
||||
$ref: '#/definitions/models.ForwardRule'
|
||||
type: array
|
||||
git_server:
|
||||
type: string
|
||||
id:
|
||||
type: string
|
||||
not_found_file:
|
||||
type: string
|
||||
owner:
|
||||
type: string
|
||||
repository:
|
||||
type: string
|
||||
spa:
|
||||
type: boolean
|
||||
type: object
|
||||
host: localhost:4321
|
||||
info:
|
||||
contact: {}
|
||||
description: Self-hosted static site deployment service
|
||||
title: Quay API
|
||||
version: "1.0"
|
||||
paths:
|
||||
/custom-headers/{id}:
|
||||
delete:
|
||||
description: Deletes a custom header group by ID
|
||||
parameters:
|
||||
- description: Custom Headers ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"204":
|
||||
description: No content
|
||||
"404":
|
||||
description: Custom headers not found
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
summary: Delete a custom header group
|
||||
tags:
|
||||
- Custom-Headers
|
||||
get:
|
||||
description: Returns a single custom header group by ID
|
||||
parameters:
|
||||
- description: Custom Headers ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Custom header group
|
||||
schema:
|
||||
$ref: '#/definitions/models.CustomHeaders'
|
||||
"404":
|
||||
description: Custom headers not found
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
summary: Get a custom header group
|
||||
tags:
|
||||
- Custom-Headers
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Replaces an existing custom header group by ID
|
||||
parameters:
|
||||
- description: Custom Headers ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
- description: Updated custom header group
|
||||
in: body
|
||||
name: customHeaders
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.CustomHeaders'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Updated custom header group
|
||||
schema:
|
||||
$ref: '#/definitions/models.CustomHeaders'
|
||||
"400":
|
||||
description: Invalid request body
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"404":
|
||||
description: Custom headers not found
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
summary: Update a custom header group
|
||||
tags:
|
||||
- Custom-Headers
|
||||
/custom-headers/{id}/headers:
|
||||
get:
|
||||
description: Returns all individual headers belonging to the given custom header
|
||||
group
|
||||
parameters:
|
||||
- description: Custom Headers ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: List of headers
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/models.Header'
|
||||
type: array
|
||||
"404":
|
||||
description: Custom headers not found
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
summary: List headers in a custom header group
|
||||
tags:
|
||||
- Custom-Headers
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Creates a new header within the given custom header group
|
||||
parameters:
|
||||
- description: Custom Headers ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
- description: Header to create
|
||||
in: body
|
||||
name: header
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.Header'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Created header
|
||||
schema:
|
||||
$ref: '#/definitions/models.Header'
|
||||
"400":
|
||||
description: Invalid request body
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"404":
|
||||
description: Custom headers not found
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
summary: Create a header
|
||||
tags:
|
||||
- Headers
|
||||
/forward-rules/{id}:
|
||||
delete:
|
||||
description: Deletes a forward rule by ID
|
||||
parameters:
|
||||
- description: Forward Rule ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"204":
|
||||
description: No content
|
||||
"404":
|
||||
description: Forward rule not found
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
summary: Delete a forward rule
|
||||
tags:
|
||||
- Forward-Rules
|
||||
get:
|
||||
description: Returns a single forward rule by ID
|
||||
parameters:
|
||||
- description: Forward Rule ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Forward rule
|
||||
schema:
|
||||
$ref: '#/definitions/models.ForwardRule'
|
||||
"404":
|
||||
description: Forward rule not found
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
summary: Get a forward rule
|
||||
tags:
|
||||
- Forward-Rules
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Replaces an existing forward rule by ID
|
||||
parameters:
|
||||
- description: Forward Rule ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
- description: Updated forward rule
|
||||
in: body
|
||||
name: rule
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.ForwardRule'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Updated forward rule
|
||||
schema:
|
||||
$ref: '#/definitions/models.ForwardRule'
|
||||
"400":
|
||||
description: Invalid request body
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"404":
|
||||
description: Forward rule not found
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
summary: Update a forward rule
|
||||
tags:
|
||||
- Forward-Rules
|
||||
/headers/{id}:
|
||||
delete:
|
||||
description: Deletes a header by ID
|
||||
parameters:
|
||||
- description: Header ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"204":
|
||||
description: No content
|
||||
"404":
|
||||
description: Header not found
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
summary: Delete a header
|
||||
tags:
|
||||
- Headers
|
||||
get:
|
||||
description: Returns a single header by ID
|
||||
parameters:
|
||||
- description: Header ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Header
|
||||
schema:
|
||||
$ref: '#/definitions/models.Header'
|
||||
"404":
|
||||
description: Header not found
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
summary: Get a header
|
||||
tags:
|
||||
- Headers
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Replaces an existing header by ID
|
||||
parameters:
|
||||
- description: Header ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
- description: Updated header
|
||||
in: body
|
||||
name: header
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.Header'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Updated header
|
||||
schema:
|
||||
$ref: '#/definitions/models.Header'
|
||||
"400":
|
||||
description: Invalid request body
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"404":
|
||||
description: Header not found
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
summary: Update a header
|
||||
tags:
|
||||
- Headers
|
||||
/sites:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Get a list of all sites
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.GetAllSitesResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
summary: Get all sites
|
||||
tags:
|
||||
- Sites
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Create a new site with the provided details
|
||||
parameters:
|
||||
- description: Site details
|
||||
in: body
|
||||
name: site
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.Site'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.Site'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
summary: Create a new site
|
||||
tags:
|
||||
- Sites
|
||||
/sites/{id}:
|
||||
delete:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Delete a site by its ID
|
||||
parameters:
|
||||
- description: Site ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"204":
|
||||
description: No Content
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
summary: Delete a site
|
||||
tags:
|
||||
- Sites
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Get a single site by its ID
|
||||
parameters:
|
||||
- description: Site ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.Site'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
summary: Get site by ID
|
||||
tags:
|
||||
- Sites
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Update an existing site by its ID
|
||||
parameters:
|
||||
- description: Site ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
- description: Updated site details
|
||||
in: body
|
||||
name: site
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.Site'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.Site'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
summary: Update an existing site
|
||||
tags:
|
||||
- Sites
|
||||
/sites/{id}/custom-headers:
|
||||
get:
|
||||
description: Returns all custom header groups associated with the given site
|
||||
parameters:
|
||||
- description: Site ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: List of custom header groups
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/models.CustomHeaders'
|
||||
type: array
|
||||
"404":
|
||||
description: Site not found
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
summary: List custom header groups for a site
|
||||
tags:
|
||||
- Custom-Headers
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Creates a new custom header group for the given site
|
||||
parameters:
|
||||
- description: Site ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
- description: Custom header group to create
|
||||
in: body
|
||||
name: customHeaders
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.CustomHeaders'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Created custom header group
|
||||
schema:
|
||||
$ref: '#/definitions/models.CustomHeaders'
|
||||
"400":
|
||||
description: Invalid request body
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"404":
|
||||
description: Site not found
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
summary: Create a custom header group
|
||||
tags:
|
||||
- Custom-Headers
|
||||
/sites/{id}/forward-rules:
|
||||
get:
|
||||
description: Returns all forward rules associated with the given site
|
||||
parameters:
|
||||
- description: Site ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: List of forward rules
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/models.ForwardRule'
|
||||
type: array
|
||||
"404":
|
||||
description: Site not found
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
summary: List forward rules for a site
|
||||
tags:
|
||||
- Forward-Rules
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Creates a new forward rule for the given site
|
||||
parameters:
|
||||
- description: Site ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
- description: Forward rule to create
|
||||
in: body
|
||||
name: rule
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.ForwardRule'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Created forward rule
|
||||
schema:
|
||||
$ref: '#/definitions/models.ForwardRule'
|
||||
"400":
|
||||
description: Invalid request body
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"404":
|
||||
description: Site not found
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/models.APIError'
|
||||
summary: Create a forward rule
|
||||
tags:
|
||||
- Forward-Rules
|
||||
swagger: "2.0"
|
||||
tags:
|
||||
- description: Manage sites
|
||||
name: Sites
|
||||
- description: Manage redirect rules for a site
|
||||
name: Forward-Rules
|
||||
- description: Manage custom header groups for a site
|
||||
name: Custom-Headers
|
||||
- description: Manage individual headers within a custom header group
|
||||
name: Headers
|
||||
@@ -3,17 +3,32 @@ module quay
|
||||
go 1.25.0
|
||||
|
||||
require (
|
||||
github.com/Flussen/swagger-fiber-v3 v1.0.1
|
||||
github.com/gofiber/fiber/v3 v3.1.0
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/joho/godotenv v1.5.1
|
||||
github.com/mattn/go-sqlite3 v1.14.38
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/KyleBanks/depth v1.2.1 // indirect
|
||||
github.com/PuerkitoBio/purell v1.1.1 // indirect
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
|
||||
github.com/andybalholm/brotli v1.2.0 // indirect
|
||||
github.com/gofiber/fiber/v3 v3.1.0 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.19.6 // indirect
|
||||
github.com/go-openapi/spec v0.20.4 // indirect
|
||||
github.com/go-openapi/swag v0.19.15 // indirect
|
||||
github.com/gofiber/schema v1.7.0 // indirect
|
||||
github.com/gofiber/utils/v2 v2.0.2 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/joho/godotenv v1.5.1 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/klauspost/compress v1.18.4 // indirect
|
||||
github.com/mailru/easyjson v0.7.6 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.38 // indirect
|
||||
github.com/philhofer/fwd v1.2.0 // indirect
|
||||
github.com/swaggo/swag v1.16.4 // indirect
|
||||
github.com/tinylib/msgp v1.6.3 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
github.com/valyala/fasthttp v1.69.0 // indirect
|
||||
@@ -21,5 +36,6 @@ require (
|
||||
golang.org/x/net v0.50.0 // indirect
|
||||
golang.org/x/sys v0.41.0 // indirect
|
||||
golang.org/x/text v0.34.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
golang.org/x/tools v0.41.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
)
|
||||
|
||||
@@ -1,5 +1,26 @@
|
||||
github.com/Flussen/swagger-fiber-v3 v1.0.1 h1:lgR2+ADJRx7Kh4oGidsf790UVwXrgC4I7p/3SAmHimw=
|
||||
github.com/Flussen/swagger-fiber-v3 v1.0.1/go.mod h1:rHViWTgpklVFVsYkWgL8zip4QHJlKwuBax8wY0G3sPw=
|
||||
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
|
||||
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
|
||||
github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI=
|
||||
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
||||
github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwToPjQ=
|
||||
github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
||||
github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=
|
||||
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
||||
github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs=
|
||||
github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns=
|
||||
github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M=
|
||||
github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I=
|
||||
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||
github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM=
|
||||
github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
|
||||
github.com/gofiber/fiber/v3 v3.1.0 h1:1p4I820pIa+FGxfwWuQZ5rAyX0WlGZbGT6Hnuxt6hKY=
|
||||
github.com/gofiber/fiber/v3 v3.1.0/go.mod h1:n2nYQovvL9z3Too/FGOfgtERjW3GQcAUqgfoezGBZdU=
|
||||
github.com/gofiber/schema v1.7.0 h1:yNM+FNRZjyYEli9Ey0AXRBrAY9jTnb+kmGs3lJGPvKg=
|
||||
@@ -10,16 +31,33 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
||||
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||
github.com/klauspost/compress v1.18.4 h1:RPhnKRAQ4Fh8zU2FY/6ZFDwTVTxgJ/EMydqSTzE9a2c=
|
||||
github.com/klauspost/compress v1.18.4/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA=
|
||||
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
||||
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
|
||||
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-sqlite3 v1.14.38 h1:tDUzL85kMvOrvpCt8P64SbGgVFtJB11GPi2AdmITgb4=
|
||||
github.com/mattn/go-sqlite3 v1.14.38/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM=
|
||||
github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/swaggo/swag v1.16.4 h1:clWJtd9LStiG3VeijiCfOVODP6VpHtKdQy9ELFG3s1A=
|
||||
github.com/swaggo/swag v1.16.4/go.mod h1:VBsHJRsDvfYvqoiMKnsdwhNV9LEMHgEDZcyVYX0sxPg=
|
||||
github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s=
|
||||
github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA=
|
||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||
@@ -28,13 +66,29 @@ github.com/valyala/fasthttp v1.69.0 h1:fNLLESD2SooWeh2cidsuFtOcrEi4uB4m1mPrkJMZy
|
||||
github.com/valyala/fasthttp v1.69.0/go.mod h1:4wA4PfAraPlAsJ5jMSqCE2ug5tqUPwKXxVj8oNECGcw=
|
||||
golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts=
|
||||
golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos=
|
||||
golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM=
|
||||
golang.org/x/net v0.50.0 h1:ucWh9eiCGyDR3vtzso0WMQinm2Dnt8cFMuQa9K33J60=
|
||||
golang.org/x/net v0.50.0/go.mod h1:UgoSli3F/pBgdJBHCTc+tp3gmrU4XswgGRgtnwWTfyM=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=
|
||||
golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk=
|
||||
golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.41.0 h1:a9b8iMweWG+S0OBnlU36rzLp20z1Rp10w+IY2czHTQc=
|
||||
golang.org/x/tools v0.41.0/go.mod h1:XSY6eDqxVNiYgezAVqqCeihT4j1U2CCsqvH3WhQpnlg=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
package fiberconfig
|
||||
|
||||
import (
|
||||
"github.com/Flussen/swagger-fiber-v3"
|
||||
"github.com/gofiber/fiber/v3"
|
||||
"github.com/gofiber/fiber/v3/middleware/logger"
|
||||
"github.com/gofiber/fiber/v3/middleware/static"
|
||||
)
|
||||
|
||||
func Setup(app *fiber.App) {
|
||||
app.Get("/api/docs.json", static.New("./docs/swagger.json"))
|
||||
|
||||
app.Get("/api/swagger/*", swagger.New(swagger.Config{
|
||||
URL: "/api/docs.json",
|
||||
Title: "mcheads.net API Documentation",
|
||||
}))
|
||||
|
||||
app.Use("/api", func(c fiber.Ctx) error {
|
||||
c.Set("Content-Type", "application/json")
|
||||
return c.Next()
|
||||
|
||||
@@ -14,6 +14,24 @@ import (
|
||||
"github.com/joho/godotenv"
|
||||
)
|
||||
|
||||
// @title Quay API
|
||||
// @version 1.0
|
||||
// @description Self-hosted static site deployment service
|
||||
// @host localhost:4321
|
||||
// @BasePath /api/v1
|
||||
|
||||
// @tag.name Sites
|
||||
// @tag.description Manage sites
|
||||
|
||||
// @tag.name Forward-Rules
|
||||
// @tag.description Manage redirect rules for a site
|
||||
|
||||
// @tag.name Custom-Headers
|
||||
// @tag.description Manage custom header groups for a site
|
||||
|
||||
// @tag.name Headers
|
||||
// @tag.description Manage individual headers within a custom header group
|
||||
|
||||
func main() {
|
||||
_ = godotenv.Load()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user