You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to use PostConfigure so that all clients in a service created through dependency injection will have their address changed based on a setting? I am modifying an extension method with no parameters called by folks after calling AddGrpcClient.
I want to avoid having the service owners using this extension make any code changes if at all possible.
From the extension method, I want to check an environment variable flag and then change the address whenever the flag is set to true.
Right now in my extension method, I am trying to use PostConfigure<GrpcClientFactoryOptions> to do the job, but from my container logs it looks like the PostConfigure is never executed, and the calls are still being made to the original address that was passed in to the Action<GrpcClientFactoryOptions> configureClient parameter when AddGrpcClient was called.
Is there a way to use PostConfigure so that all clients in a service created through dependency injection will have their address changed based on a setting? I am modifying an extension method with no parameters called by folks after calling AddGrpcClient.
I want to avoid having the service owners using this extension make any code changes if at all possible.
in Startup.cs ConfigureServices method:
services.AddGrpcClient<CLIENT_TYPE>(...).**EXTENSION_METHOD**
From the extension method, I want to check an environment variable flag and then change the address whenever the flag is set to true.
Right now in my extension method, I am trying to use PostConfigure<GrpcClientFactoryOptions> to do the job, but from my container logs it looks like the PostConfigure is never executed, and the calls are still being made to the original address that was passed in to the Action<GrpcClientFactoryOptions> configureClient parameter when AddGrpcClient was called.
currently doing something like this:
Is my approach possible, and if it is, where I am going wrong in my execution?
Thanks for any insights you can provide!
The text was updated successfully, but these errors were encountered: