answer/internal/install/install_main.go

33 lines
707 B
Go
Raw Normal View History

2022-11-03 20:09:04 +08:00
package install
import (
"fmt"
2022-11-03 20:09:04 +08:00
"os"
"github.com/answerdev/answer/internal/base/translator"
"github.com/answerdev/answer/internal/cli"
)
var (
port = os.Getenv("INSTALL_PORT")
confPath = ""
)
func Run(configPath string) {
confPath = configPath
// initialize translator for return internationalization error when installing.
_, err := translator.NewTranslator(&translator.I18n{BundleDir: cli.I18nPath})
if err != nil {
panic(err)
}
installServer := NewInstallHTTPServer()
if len(port) == 0 {
port = "80"
}
fmt.Printf("[SUCCESS] answer installation service will run at: http://localhost:%s/install/ \n", port)
2022-11-03 20:09:04 +08:00
if err = installServer.Run(":" + port); err != nil {
panic(err)
}
}