зеркало из https://github.com/SteeltoeOSS/Samples.git
Enable quick switch between eureka and consul in discovery sample
This commit is contained in:
Родитель
bac42983e7
Коммит
3b34d80456
|
@ -19,7 +19,8 @@
|
|||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="$(AspNetCoreVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$(AspNetCoreVersion)" />
|
||||
<PackageReference Include="Steeltoe.Common.Hosting" Version="$(SteeltoeVersion)" />
|
||||
<PackageReference Include="Steeltoe.Discovery.ClientBase" Version="$(SteeltoeVersion)" />
|
||||
<PackageReference Include="Steeltoe.Discovery.ClientCore" Version="$(SteeltoeVersion)" />
|
||||
<PackageReference Include="Steeltoe.Discovery.Consul" Version="$(SteeltoeVersion)" />
|
||||
<PackageReference Include="Steeltoe.Discovery.Eureka" Version="$(SteeltoeVersion)" />
|
||||
<PackageReference Include="Steeltoe.Extensions.Configuration.CloudFoundryCore" Version="$(SteeltoeVersion)" />
|
||||
<PackageReference Include="Steeltoe.Extensions.Configuration.PlaceholderCore" Version="$(SteeltoeVersion)" />
|
||||
|
|
|
@ -2,7 +2,6 @@ using Microsoft.AspNetCore.Hosting;
|
|||
using Microsoft.Extensions.Hosting;
|
||||
using Steeltoe.Common.Hosting;
|
||||
using Steeltoe.Discovery.Client;
|
||||
using Steeltoe.Discovery.Eureka;
|
||||
using Steeltoe.Extensions.Configuration.CloudFoundry;
|
||||
using Steeltoe.Extensions.Configuration.Placeholder;
|
||||
|
||||
|
@ -17,13 +16,15 @@ namespace FortuneTellerService
|
|||
|
||||
public static IHost BuildHost(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.ConfigureWebHostDefaults(host => host.UseStartup<Startup>())
|
||||
.ConfigureWebHostDefaults(host =>
|
||||
{
|
||||
host.UseStartup<Startup>();
|
||||
})
|
||||
.AddCloudFoundryConfiguration()
|
||||
.AddDiscoveryClient()
|
||||
.AddPlaceholderResolver()
|
||||
.AddServiceDiscovery(options => options.UseEureka())
|
||||
.UseCloudHosting(5000)
|
||||
.Build();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
"Fortune-Teller-Service-Consul": {
|
||||
"commandName": "Project",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Consul"
|
||||
"ASPNETCORE_ENVIRONMENT": "consul"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
"IncludeScopes": false,
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Pivotal": "Debug",
|
||||
"Steeltoe": "Debug"
|
||||
"Steeltoe.Discovery": "Trace"
|
||||
}
|
||||
},
|
||||
"eureka": {
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
"IncludeScopes": false,
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Pivotal": "Information",
|
||||
"Steeltoe": "Information"
|
||||
"Steeltoe.Discovery": "Trace"
|
||||
},
|
||||
"Console": {
|
||||
"DisableColors": true
|
|
@ -2,9 +2,7 @@
|
|||
"Logging": {
|
||||
"IncludeScopes": false,
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Pivotal": "Information",
|
||||
"Steeltoe": "Information"
|
||||
"Default": "Information"
|
||||
},
|
||||
"Console": {
|
||||
"DisableColors": true
|
||||
|
@ -21,21 +19,6 @@
|
|||
// "registrationMethod" : "direct"
|
||||
// }
|
||||
// }
|
||||
},
|
||||
"eureka": {
|
||||
"client": {
|
||||
"serviceUrl": "http://localhost:8761/eureka/",
|
||||
"shouldFetchRegistry": false,
|
||||
"ValidateCertificates": false
|
||||
},
|
||||
"instance": {
|
||||
"port": 5000,
|
||||
"appName": "fortuneService", // this shouldn't be needed, there's probably a bug in 3.0 preventing spring:application:name from being used here
|
||||
"instanceId": "${spring:application:name}"
|
||||
// Remove comments to enable SSL requests
|
||||
// More changes in Program.cs are required if using direct C2C communications
|
||||
//,"securePortEnabled": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<PackageReference Include="Steeltoe.Common.Hosting" Version="$(SteeltoeVersion)" />
|
||||
<PackageReference Include="Steeltoe.Extensions.Configuration.CloudFoundryCore" Version="$(SteeltoeVersion)" />
|
||||
<PackageReference Include="Steeltoe.Discovery.ClientCore" Version="$(SteeltoeVersion)" />
|
||||
<PackageReference Include="Steeltoe.Discovery.Consul" Version="$(SteeltoeVersion)" />
|
||||
<PackageReference Include="Steeltoe.Discovery.Eureka" Version="$(SteeltoeVersion)" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -20,6 +20,12 @@
|
|||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"Fortune-Teller-UI-Consul": {
|
||||
"commandName": "Project",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "consul"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,7 +25,7 @@ namespace Fortune_Teller_UI
|
|||
{
|
||||
c.BaseAddress = new Uri("http://fortuneService/api/fortunes/");
|
||||
})
|
||||
.AddHttpMessageHandler<DiscoveryHttpMessageHandler>()
|
||||
.AddServiceDiscovery()
|
||||
.AddTypedClient<IFortuneService, FortuneService>();
|
||||
|
||||
// Add framework services.
|
||||
|
|
|
@ -3,8 +3,14 @@
|
|||
"IncludeScopes": false,
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Pivotal": "Debug",
|
||||
"Steeltoe": "Debug"
|
||||
"Steeltoe.Discovery": "Trace"
|
||||
}
|
||||
},
|
||||
"eureka": {
|
||||
"client": {
|
||||
"serviceUrl": "http://localhost:8761/eureka/",
|
||||
"shouldRegisterWithEureka": false,
|
||||
"ValidateCertificates": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
"IncludeScopes": false,
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Pivotal": "Information",
|
||||
"Steeltoe": "Information"
|
||||
"Steeltoe.Discovery": "Trace"
|
||||
},
|
||||
"Console": {
|
||||
"DisableColors": true
|
|
@ -3,7 +3,6 @@
|
|||
"IncludeScopes": false,
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Pivotal": "Information",
|
||||
"Steeltoe": "Information"
|
||||
},
|
||||
"Console": {
|
||||
|
@ -14,13 +13,6 @@
|
|||
"application": {
|
||||
"name": "fortuneUI"
|
||||
}
|
||||
},
|
||||
"eureka": {
|
||||
"client": {
|
||||
"serviceUrl": "http://localhost:8761/eureka/",
|
||||
"shouldRegisterWithEureka": false,
|
||||
"ValidateCertificates": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<SteeltoeVersion>3.0.0-3432</SteeltoeVersion>
|
||||
<SteeltoeVersion>3.0.0-3468</SteeltoeVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GitInfoVersion>2.0.20</GitInfoVersion>
|
||||
|
|
Загрузка…
Ссылка в новой задаче