fix 修复从环境变量读取数据库配置出错的问题

This commit is contained in:
timerzz 2024-08-26 17:19:44 +08:00
parent 742fc5250a
commit c2ccb721a7

View File

@ -18,7 +18,7 @@ func InitDatabase(opt *DBOption) (*gorm.DB, error) {
func InitDefaultDatabase() (*gorm.DB, error) { func InitDefaultDatabase() (*gorm.DB, error) {
path := os.Getenv(ConfigPathEnvKey) path := os.Getenv(ConfigPathEnvKey)
if path != "" { if path == "" {
path = DefaultConfigPath path = DefaultConfigPath
} }
cfg, err := LoadDBConfig(path) cfg, err := LoadDBConfig(path)