goProject/trunk/center/usercenter/main.go
2025-01-23 16:12:49 +08:00

44 lines
810 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package main
import (
"common/connection"
"sync"
_ "common/resultStatus"
"common/webServer"
_ "usercenter/internal"
)
var (
wg sync.WaitGroup
)
func init() {
// 设置WaitGroup需要等待的数量只要有一个服务器出现错误都停止服务器
wg.Add(1)
}
func main() {
//加载配置
loadConfig()
// 启动webserver
go webServer.Start(&wg)
// 阻塞等待以免main线程退出
wg.Wait()
}
// loadConfig 用于加载配置信息。
// 该函数会读取配置文件或环境变量中的设置,并根据这些设置初始化程序所需的配置。
// 目前函数的实现为空,需要根据实际的配置加载逻辑进行填充。
func loadConfig() {
//设置数据类型
connection.SetModelDB(connection.GetUserDB())
//构建数据库
connection.BuildDB()
}