Feast.Extensions.ServiceDiscovery.Yarp.Consul 0.2.0

dotnet add package Feast.Extensions.ServiceDiscovery.Yarp.Consul --version 0.2.0
                    
NuGet\Install-Package Feast.Extensions.ServiceDiscovery.Yarp.Consul -Version 0.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Feast.Extensions.ServiceDiscovery.Yarp.Consul" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Feast.Extensions.ServiceDiscovery.Yarp.Consul" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Feast.Extensions.ServiceDiscovery.Yarp.Consul" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Feast.Extensions.ServiceDiscovery.Yarp.Consul --version 0.2.0
                    
#r "nuget: Feast.Extensions.ServiceDiscovery.Yarp.Consul, 0.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Feast.Extensions.ServiceDiscovery.Yarp.Consul@0.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Feast.Extensions.ServiceDiscovery.Yarp.Consul&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Feast.Extensions.ServiceDiscovery.Yarp.Consul&version=0.2.0
                    
Install as a Cake Tool

Feast.Extensions.ServiceDiscovery.Yarp.Consul

Use Consul as the destination resolving backend of Yarp

📦️ Dependencies

📕 Usage

in Program.cs

// any chance we can resolve IConsulClient from service provider
builder.Services.Add<IConsulClient>();

// configure Yarp
builder.Services.AddReverseProxy()
    .LoadFrom(whatever_it_is)
    .AddConsulDestinationResolver(); // add consul as destination resolver

in Yarp configuration whatever_it_is.json like

{
  "Routes": {
    "My-Service": {
      "ClusterId": "NotImportant",
      "Match": {
        "Path": "{**all}"
      }
    }
  },
  "Clusters": {
    "NotImportant": {
      "Destinations": {
        "consul/dc1": {
          "Address": "https+http://my-service"
        },
        "others will still working" : {
          "Address" : "..."
        }
      }
    }
  }
}

In Destinations field, the name should be formatted like consul/dc{number} indicates that this destination points to consul

the Host of Address will be filled into the query as service field, and send request like

http://your-consul/dc1/health/service/my-service

🛠 Customize

If you want to self-resolve naming policy instead of consul/dc like, you can

builder.Services.AddReverseProxy()
    .AddConsulDestinationResolver(o => 
    {
        o.TransformContext = (name, config) => 
        {
            // your custom strategy, just tell me datacenter and service as well
        }
    });

Also including query options configuring

builder.Services.AddReverseProxy()
    .AddConsulDestinationResolver(o => 
    {
        o.OptionsFactory = context => 
        {
            return your options;
        }
    });
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0 191 1/4/2026
0.1.0 391 12/8/2025

Add path and query, supports 'consul' default as 'consul/dc1'