A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
feat(install): The first installation automatically switches to the installation url
LinkinStaraf930eb425c7
diff --git a/internal/install/install_controller.go b/internal/install/install_controller.goindex 561c6dc4..465378f7 100644--- a/internal/install/install_controller.go+++ b/internal/install/install_controller.go@@ -1,6 +1,7 @@package installimport (+ "net/http""os""path/filepath""time"@@ -30,6 +31,21 @@ func LangOptions(ctx *gin.Context) {handler.HandleResponse(ctx, nil, translator.LanguageOptions)}+// CheckConfigFileAndRedirectToInstallPage if config file not exist try to redirect to install page+// @Summary if config file not exist try to redirect to install page+// @Description if config file not exist try to redirect to install page+// @Tags installation+// @Accept json+// @Produce json+// @Router / [get]+func CheckConfigFileAndRedirectToInstallPage(ctx *gin.Context) {+ if cli.CheckConfigFile(confPath) {+ ctx.Redirect(http.StatusFound, "/50x")+ } else {+ ctx.Redirect(http.StatusFound, "/install")+ }+}+// CheckConfigFile check config file if exist when installation// @Summary check config file if exist when installation// @Description check config file if exist when installationdiff --git a/internal/install/install_server.go b/internal/install/install_server.goindex c0c38a7f..c6361f65 100644--- a/internal/install/install_server.go+++ b/internal/install/install_server.go@@ -34,6 +34,7 @@ func NewInstallHTTPServer() *gin.Engine {}))installApi := r.Group("")+ installApi.GET("/", CheckConfigFileAndRedirectToInstallPage)installApi.GET("/install", WebPage)installApi.GET("/50x", WebPage)installApi.GET("/installation/language/options", LangOptions)