Skip to content

Commit

Permalink
从注册中心获取服务端地址,优先于本地配置文件
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Oct 10, 2023
1 parent 01f9162 commit bf42fbe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions AntJob.Server/AntJob.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
<ApplicationIcon>favicon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<None Remove="appsettings.json" />
</ItemGroup>
<ItemGroup>
<Content Include="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="favicon.ico" />
</ItemGroup>
<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion AntJob/Scheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ public void Start()
{
network.Tracer ??= Tracer;

if (network.Server.IsNullOrEmpty())
// 从注册中心获取服务端地址,优先于本地配置文件
if (network.Server.IsNullOrEmpty() || network.Server.EqualIgnoreCase(AntSetting.Current.Server))
{
// 从注册中心获取包
var registry = ServiceProvider?.GetService<IRegistry>();
Expand Down

0 comments on commit bf42fbe

Please sign in to comment.