refactor: 切换数据库连接到远程服务器

- PostgreSQL: 192.168.1.154:5432 (auto_agent)
- Redis: 192.168.1.154:31040
- RabbitMQ: 192.168.1.154:31020
- RabbitMQ 注册代码支持 Port 配置
This commit is contained in:
xiangning 2026-05-11 02:47:38 +08:00
parent fb28bbdbe5
commit 88eccbc952
2 changed files with 9 additions and 7 deletions

View File

@ -7,13 +7,14 @@
},
"AllowedHosts": "*",
"ConnectionStrings": {
"Default": "Host=localhost;Port=5432;Database=rag;Username=rag;Password=rag123",
"Redis": "localhost:6379"
"Default": "Host=192.168.1.154;Port=5432;Database=rag;Username=auto_agent;Password=auto_agent",
"Redis": "192.168.1.154:31040,password=xn001624."
},
"RabbitMq": {
"Host": "localhost",
"Username": "rag",
"Password": "rag123"
"Host": "192.168.1.154",
"Port": 31020,
"Username": "guest",
"Password": "xn001624."
},
"Jwt": {
"SigningKey": "RagJwtSecretKey2026MustBeAtLeast32CharsLong!",

View File

@ -13,8 +13,9 @@ public static class RabbitMqExtensions
return new ConnectionFactory
{
HostName = config["RabbitMq:Host"] ?? "localhost",
UserName = config["RabbitMq:Username"] ?? "rag",
Password = config["RabbitMq:Password"] ?? "rag123"
Port = int.TryParse(config["RabbitMq:Port"], out var port) ? port : 5672,
UserName = config["RabbitMq:Username"] ?? "guest",
Password = config["RabbitMq:Password"] ?? "guest"
};
});
return services;