diff --git a/cmd/debug_page.go b/cmd/debug_page.go index 00d44b80..607ee5ca 100644 --- a/cmd/debug_page.go +++ b/cmd/debug_page.go @@ -181,7 +181,6 @@ func newApiHandler(debugMux *debugMux) *gin.Engine { registerGinRoute(v1, "GET", "Route favicon", "/favicon", apiV1.FavIcon) registerGinRoute(v1, "GET", "Route health", "/health", apiV1.Health) registerGinRoute(v1, "GET", "List icons", "/icons", apiV1.Icons) - registerGinRoute(v1, "POST", "Config reload", "/reload", apiV1.Reload) registerGinRoute(v1, "GET", "Route stats", "/stats", apiV1.Stats) route := v1.Group("/route") diff --git a/internal/api/handler.go b/internal/api/handler.go index 5878db6b..e4753538 100644 --- a/internal/api/handler.go +++ b/internal/api/handler.go @@ -76,7 +76,6 @@ func NewHandler(requireAuth bool) *gin.Engine { v1.GET("/favicon", apiV1.FavIcon) v1.GET("/health", apiV1.Health) v1.GET("/icons", apiV1.Icons) - v1.POST("/reload", apiV1.Reload) v1.GET("/stats", apiV1.Stats) route := v1.Group("/route") diff --git a/internal/api/v1/reload.go b/internal/api/v1/reload.go deleted file mode 100644 index ba24d46d..00000000 --- a/internal/api/v1/reload.go +++ /dev/null @@ -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")) -}