mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 09:18:31 +02:00
BREAKING(api): remove /reload api
This commit is contained in:
@@ -181,7 +181,6 @@ func newApiHandler(debugMux *debugMux) *gin.Engine {
|
|||||||
registerGinRoute(v1, "GET", "Route favicon", "/favicon", apiV1.FavIcon)
|
registerGinRoute(v1, "GET", "Route favicon", "/favicon", apiV1.FavIcon)
|
||||||
registerGinRoute(v1, "GET", "Route health", "/health", apiV1.Health)
|
registerGinRoute(v1, "GET", "Route health", "/health", apiV1.Health)
|
||||||
registerGinRoute(v1, "GET", "List icons", "/icons", apiV1.Icons)
|
registerGinRoute(v1, "GET", "List icons", "/icons", apiV1.Icons)
|
||||||
registerGinRoute(v1, "POST", "Config reload", "/reload", apiV1.Reload)
|
|
||||||
registerGinRoute(v1, "GET", "Route stats", "/stats", apiV1.Stats)
|
registerGinRoute(v1, "GET", "Route stats", "/stats", apiV1.Stats)
|
||||||
|
|
||||||
route := v1.Group("/route")
|
route := v1.Group("/route")
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ func NewHandler(requireAuth bool) *gin.Engine {
|
|||||||
v1.GET("/favicon", apiV1.FavIcon)
|
v1.GET("/favicon", apiV1.FavIcon)
|
||||||
v1.GET("/health", apiV1.Health)
|
v1.GET("/health", apiV1.Health)
|
||||||
v1.GET("/icons", apiV1.Icons)
|
v1.GET("/icons", apiV1.Icons)
|
||||||
v1.POST("/reload", apiV1.Reload)
|
|
||||||
v1.GET("/stats", apiV1.Stats)
|
v1.GET("/stats", apiV1.Stats)
|
||||||
|
|
||||||
route := v1.Group("/route")
|
route := v1.Group("/route")
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
package v1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"github.com/yusing/godoxy/internal/config"
|
|
||||||
apitypes "github.com/yusing/goutils/apitypes"
|
|
||||||
)
|
|
||||||
|
|
||||||
// @x-id "reload"
|
|
||||||
// @BasePath /api/v1
|
|
||||||
// @Summary Reload config
|
|
||||||
// @Description Reload config
|
|
||||||
// @Tags v1
|
|
||||||
// @Accept json
|
|
||||||
// @Produce json
|
|
||||||
// @Success 200 {object} apitypes.SuccessResponse
|
|
||||||
// @Failure 403 {object} apitypes.ErrorResponse
|
|
||||||
// @Failure 500 {object} apitypes.ErrorResponse
|
|
||||||
// @Router /reload [post]
|
|
||||||
func Reload(c *gin.Context) {
|
|
||||||
if err := config.Reload(); err != nil {
|
|
||||||
c.Error(apitypes.InternalServerError(err, "failed to reload config"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
c.JSON(http.StatusOK, apitypes.Success("config reloaded"))
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user