Skip to content
Discussion options

You must be logged in to vote

For future travellers, here's a small method to extract the endpoint from the env variable. Extend with appropriate error handling for your production code.

public static class ServiceDiscoveryUtilities
{
    public static string? GetServiceEndpoint(string serviceName, string endpointName, int index = 0) =>
      Environment.GetEnvironmentVariable($"services__{serviceName}__{endpointName}__{index}");
}

Replies: 5 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@AldeRoberge
Comment options

@mmacneil
Comment options

Answer selected by davidfowl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants