fix: 修复 Docker Compose 环境下 PostgreSQL 连接失败
This commit is contained in:
@@ -56,6 +56,10 @@ func main() {
|
||||
var sessRepo store.SessionRepository
|
||||
|
||||
if cfg.Storage.Driver == "postgres" {
|
||||
if cfg.Storage.DSN == "" {
|
||||
logger.Log.Fatalw("storage.dsn is required when storage.driver is postgres",
|
||||
"hint", "set CAMTALK_STORAGE_DSN environment variable")
|
||||
}
|
||||
pool, err := store.NewPostgresPool(ctx, cfg.Storage.DSN)
|
||||
if err != nil {
|
||||
logger.Log.Fatalw("failed to connect to postgres", "error", err)
|
||||
|
||||
@@ -152,6 +152,7 @@ func Load() (*Config, error) {
|
||||
v.SetDefault("ai.tts.output_format", "mp3")
|
||||
v.SetDefault("ai.tts.sample_rate", 24000)
|
||||
v.SetDefault("storage.driver", "memory")
|
||||
v.SetDefault("storage.dsn", "")
|
||||
v.SetDefault("log.level", "info")
|
||||
v.SetDefault("log.format", "console")
|
||||
v.SetDefault("auth.access_ttl", 15)
|
||||
|
||||
Reference in New Issue
Block a user