Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConsulClient UnregisterService and custom JSConfig scope changes #30

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/Servicestack.Discovery.Consul/Consul/ConsulClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ public static void RegisterService(ServiceRegistration registration)
ServiceValidator.ValidateAndThrow(consulServiceRegistration);

var registrationUrl = ConsulFeature.ConsulAgentResolver.CombineWith(consulServiceRegistration.ToPutUrl());
using (var config = JsConfig.BeginScope())
using (JsConfig.With(new Config { TextCase = TextCase.Default, IncludeNullValues = false }))
{
config.EmitCamelCaseNames = false;
config.IncludeNullValues = false;
registrationUrl.PutJsonToUrl(consulServiceRegistration, null,
response =>
{
Expand Down Expand Up @@ -73,7 +71,8 @@ public static void RegisterService(ServiceRegistration registration)
/// <exception cref="GatewayServiceDiscoveryException">throws exception if unregistering was not successful</exception>
public static void UnregisterService(string serviceId)
{
ConsulUris.DeregisterService(serviceId).GetJsonFromUrl(
ConsulUris.DeregisterService(serviceId).PutJsonToUrl(
null,
null,
response =>
{
Expand Down Expand Up @@ -168,11 +167,8 @@ public static void RegisterHealthChecks(params ServiceHealthCheck[] healthChecks
};
HealthcheckValidator.ValidateAndThrow(consulCheck);

using (var config = JsConfig.BeginScope())
using (JsConfig.With(new Config { TextCase = TextCase.Default, IncludeNullValues = false }))
{
config.EmitCamelCaseNames = false;
config.IncludeNullValues = false;

ConsulFeature.ConsulAgentResolver.CombineWith(consulCheck.ToPutUrl()).PutJsonToUrl(
consulCheck,
null,
Expand Down Expand Up @@ -205,4 +201,4 @@ private static ConsulServiceResponse[] GetConsulServiceResponses(string response
return health.Select(ConsulServiceResponse.Create).ToArray();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GitLink" Version="3.1.0" PrivateAssets="All" />
<PackageReference Include="ServiceStack.Server" Version="5.0.0" />
<PackageReference Include="ServiceStack.Server" Version="5.4.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Web" Condition="'$(TargetFramework)' == 'net45'" />
</ItemGroup>
</Project>
</Project>