feat(config): 添加配置管理模块和数据库连接功能

- 实现全局配置结构体,包含服务、数据库和日志配置
- 添加 Viper 配置加载功能,支持 YAML 文件和环境变量
- 创建 config.yaml 配置文件,包含服务器和数据库连接信息
- 集成 GORM 数据库连接功能,支持 PostgreSQL 驱动
- 更新依赖包,添加 postgres 驱动和相关工具库
- 实现 main 入口函数,加载配置并初始化服务
- 创建详细的 Phase 1 基础设施实施计划文档
This commit is contained in:
yangzhaohan
2026-07-09 08:52:29 +08:00
parent ea1dd4876d
commit 262c8377b9
8 changed files with 484 additions and 10 deletions
+4
View File
@@ -20,8 +20,10 @@ require (
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgx/v5 v5.10.0 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/joho/godotenv v1.5.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
@@ -45,8 +47,10 @@ require (
golang.org/x/arch v0.22.0 // indirect
golang.org/x/crypto v0.48.0 // indirect
golang.org/x/net v0.51.0 // indirect
golang.org/x/sync v0.19.0 // indirect
golang.org/x/sys v0.41.0 // indirect
golang.org/x/text v0.34.0 // indirect
google.golang.org/protobuf v1.36.10 // indirect
gorm.io/driver/postgres v1.6.0 // indirect
gorm.io/gorm v1.31.2 // indirect
)