Ocelot.Provider.Static
6.0.0
dotnet add package Ocelot.Provider.Static --version 6.0.0
NuGet\Install-Package Ocelot.Provider.Static -Version 6.0.0
<PackageReference Include="Ocelot.Provider.Static" Version="6.0.0" />
paket add Ocelot.Provider.Static --version 6.0.0
#r "nuget: Ocelot.Provider.Static, 6.0.0"
// Install Ocelot.Provider.Static as a Cake Addin #addin nuget:?package=Ocelot.Provider.Static&version=6.0.0 // Install Ocelot.Provider.Static as a Cake Tool #tool nuget:?package=Ocelot.Provider.Static&version=6.0.0
Ocelot Static Discovery provider
This package adds to the ocelot the ability to define static services in your configuration.
Ocelot allows you to specify a service discovery provider and will use this to find the host and port for the downstream service Ocelot is forwarding a request to. At the moment this is only supported in the GlobalConfiguration section which means the same service discovery provider will be used for all Routes you specify a ServiceName for at Route level.
Please show the value
Choosing a project dependency could be difficult. We need to ensure stability and maintainability of our projects. Surveys show that GitHub stars count play an important factor when assessing library quality.
⭐ Please give this repository a star. It takes seconds and help thousands of developers! ⭐
Support development
It doesn't matter if you are a professional developer, creating a startup or work for an established company. All of us care about our tools and dependencies, about stability and security, about time and money we can safe, about quality we can offer. Please consider sponsoring to give me an extra motivational push to develop the next great feature.
If you represent a company, want to help the entire community and show that you care, please consider sponsoring using one of the higher tiers. Your company logo will be shown here for all developers, building a strong positive relation.
Installation
The library is available as a nuget package. You can install it as any other nuget package from your IDE, try to search by Ocelot.Provider.Static
. You can find package details on this webpage.
// Package Manager
Install-Package Ocelot.Provider.Static
// .NET CLI
dotnet add package Ocelot.Provider.Static
// Package reference in .csproj file
<PackageReference Include="Ocelot.Provider.Static" Version="6.0.0" />
Then add the following to your ConfigureServices method.
s.AddOcelot()
..AddStaticConfiguration();
The following is required in the GlobalConfiguration.
"GlobalConfiguration": {
"ServiceDiscoveryProvider": {
"Type": "StaticConfiguration",
"PollingIntervalSeconds": 10000
}
}
In order to tell Ocelot a Route is to use the service discovery provider for its host and port you must add the ServiceName and load balancer you wish to use when making requests downstream. At the moment Ocelot has a RoundRobin and LeastConnection algorithm you can use. If no load balancer is specified Ocelot will not load balance requests.
{
"DownstreamPathTemplate": "/v2/{everything}",
"DownstreamScheme": "http",
"UpstreamPathTemplate": "/petstore/{everything}",
"UpstreamHttpMethod": [ "GET", "POST", "PUT", "DELETE" ],
"ServiceName": "petstore",
"LoadBalancerOptions": {
"Type": "LeastConnection"
},
}
Configuration
The following example implemented the static configuration provider.
{
"Services": {
"Users": [
{
"DownstreamPath": "http://localhost:9003"
}
],
"projects": [
{
"DownstreamPath": "http://localhost:9002"
}
],
"Authorization": [
{
"DownstreamPath": "https://authorizationService.domain.com"
}
]
},
}
Polling
This provider from optimization reason cache services 5 minutes by default
If you want change or turn off this caching, then set PollingInterval
in provider definition (miliseconds).
Change services definition section name
If you want change default section name, than you can set property AppConfigurationSectionName
in provider definition.
"GlobalConfiguration": {
"ServiceDiscoveryProvider": {
"Type": "StaticConfiguration",
"PollingIntervalSeconds": 10000,
"AppConfigurationSectionName": "ApiServices"
}
}
How to Contribute
Everyone is welcome to contribute to this project! Feel free to contribute with pull requests, bug reports or enhancement suggestions.
Bugs and Feedback
For bugs, questions and discussions please use the GitHub Issues.
License
This project is licensed under MIT License.
Product | Versions 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 was computed. 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. |
-
net6.0
- Ocelot (>= 18.0.0)
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 |
---|---|---|
6.0.0 | 261 | 5/29/2022 |