u
This commit is contained in:
1 parent
4ce951dd56
commit
8a3dea8545
44 files changed
+1599
-30
No files matched your search
@@ -1,6 +1,8 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"allapp/db"
|
||||
"allapp/utils/redisx"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -25,6 +27,22 @@ func InitConfig() error {
|
||||
initLogger()
|
||||
initUniqueId()
|
||||
|
||||
// 加载数据库
|
||||
pool, queries, err := initDB()
|
||||
if err != nil {
|
||||
return fmt.Errorf("加载数据库失败: %w", err)
|
||||
}
|
||||
|
||||
db.Pool = pool
|
||||
db.Queries = queries
|
||||
|
||||
// 加载 redis
|
||||
redis, err := initRedis()
|
||||
if err != nil {
|
||||
return fmt.Errorf("加载Redis失败: %w", err)
|
||||
}
|
||||
redisx.Client = redis
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -59,6 +77,9 @@ func defaultConfig() *Config {
|
||||
MaxAge: 30,
|
||||
Compress: true,
|
||||
},
|
||||
Redis: RedisConfig{
|
||||
Port: 6379,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user