feat config

This commit is contained in:
2025-12-11 11:12:36 +08:00
parent d6f770fbb3
commit 71d4e593c7
19 changed files with 229 additions and 326 deletions

View File

@@ -7,16 +7,16 @@ import (
"math/rand"
)
func (p *Program) initBase() (*config.Config, error) {
func (p *Program) initBase() error {
// 配置
cfg, err := config.LoadConfig("./config")
if err != nil {
return nil, err
if err := config.LoadConfig(); err != nil {
return err
}
cfg := config.Get()
// 日志
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
return nil
}