mirror of https://gitee.com/answerdev/answer.git
feat(install): The first installation automatically switches to the installation url
This commit is contained in:
parent
2e7349fff8
commit
af930eb425
|
@ -1,6 +1,7 @@
|
|||
package install
|
||||
|
||||
import (
|
||||
"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 installation
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue