加入网络层
This commit is contained in:
22
Server/Gateway/app/base.go
Normal file
22
Server/Gateway/app/base.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"common/log"
|
||||
"common/utils"
|
||||
"gateway/config"
|
||||
"math/rand"
|
||||
)
|
||||
|
||||
func (p *Program) initBase() (*config.Config, error) {
|
||||
// 配置
|
||||
cfg, err := config.LoadConfig("./config")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 日志
|
||||
log.Init(cfg.Log.Debug, cfg.Log.MaxSize, cfg.Log.MaxBackups, cfg.Log.MaxAge, cfg.Log.Level)
|
||||
// 雪花
|
||||
utils.InitSnowflake(int64(rand.Intn(1000)))
|
||||
|
||||
return cfg, nil
|
||||
}
|
||||
Reference in New Issue
Block a user