Skip to content

Commit

Permalink
feat(grpc): separate options for grpc clients with support for default
Browse files Browse the repository at this point in the history
  • Loading branch information
SonicGD committed Apr 10, 2023
1 parent efb01ba commit 07427e2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Sitko.Core.Grpc.Client.Consul/ConsulGrpcClientModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ public class ConsulGrpcClientModule<TClient> : GrpcClientModule<TClient, ConsulG
ConsulGrpcClientModuleOptions<TClient>>
where TClient : ClientBase<TClient>
{
public override string OptionsKey => "Grpc:Client:Consul";
public override string OptionsKey => $"Grpc:Client:Consul:{typeof(TClient).Name}";

public override string[] OptionKeys => new[] { "Grpc:Client:Consul:Default", OptionsKey };

public override IEnumerable<Type> GetRequiredModules(IApplicationContext applicationContext,
ConsulGrpcClientModuleOptions<TClient> options) =>
Expand All @@ -19,4 +21,3 @@ public class ConsulGrpcClientModuleOptions<TClient> : GrpcClientModuleOptions<TC
where TClient : ClientBase<TClient>
{
}

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public class ExternalGrpcClientModule<TClient> : GrpcClientModule<TClient,
{
public override string OptionsKey => $"Grpc:Client:External:{typeof(TClient).Name}";

public override string[] OptionKeys => new[] { "Grpc:Client:External:Default", OptionsKey };

protected override void RegisterResolver(IServiceCollection services,
ExternalGrpcClientModuleOptions<TClient> config) =>
services.AddSingleton<IGrpcServiceAddressResolver<TClient>>(
Expand Down

0 comments on commit 07427e2

Please sign in to comment.