Refactor installation and database initialization.

Added optional database name to installation.
This commit is contained in:
Hintay 2022-02-19 03:02:06 +08:00
parent 759a235e7e
commit 3bf2677d69
No known key found for this signature in database
GPG key ID: 120FC7FF121F2F2D
8 changed files with 70 additions and 33 deletions

12
main.go
View file

@ -25,21 +25,21 @@ func main() {
_ = mime.AddExtensionType(".js", "text/javascript; charset=utf-8")
var confPath string
flag.StringVar(&confPath, "config", "./app.ini", "Specify the configuration file")
flag.StringVar(&confPath, "config", "app.ini", "Specify the configuration file")
flag.Parse()
settings.Init(confPath)
model.Init()
log.Printf("nginx config dir path: %s", tool2.GetNginxConfPath(""))
if "" != settings.ServerSettings.JwtSecret {
model.Init()
go tool2.AutoCert()
}
srv := &http.Server{
Addr: ":" + settings.ServerSettings.HttpPort,
Handler: router.InitRouter(),
}
log.Printf("nginx config dir path: %s", tool2.GetNginxConfPath(""))
go tool2.AutoCert()
// Initializing the server in a goroutine so that
// it won't block the graceful shutdown handling below
go func() {