KongRegister 3.0.0

dotnet add package KongRegister --version 3.0.0
NuGet\Install-Package KongRegister -Version 3.0.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="KongRegister" Version="3.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add KongRegister --version 3.0.0
#r "nuget: KongRegister, 3.0.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.
// Install KongRegister as a Cake Addin
#addin nuget:?package=KongRegister&version=3.0.0

// Install KongRegister as a Cake Tool
#tool nuget:?package=KongRegister&version=3.0.0

Logo

KongRegister

License NuGet version AppVeyor build (master)

Register your AspNetCore web-service in Kong API Gateway on startup and unregister it when you application is shutting down.

Getting started

Install KongRegister package :

Install-Package KongRegister

Add the following configuration in your appsettings.json :

"KongRegister": {
    "OnStartup" : true,
    "KongApiUrl": "http://YourKongApiUrl:8081",
    "KongApiKeyHeader": "YourApikeyHeader",
    "KongApiKey": "YourApiKey",
    "UpstreamId": "YourUpstreamId",
    "TargetHostDiscovery": "dynamic",
    "TargetPortDiscovery": "dynamic",
    "TargetWeight": 1000
  }

Add the reference in your Startup class :

using KongRegister;

Add those two services in the ConfigureServices method :

public void ConfigureServices(IServiceCollection services)
{
    services.ConfigureKongRegister(Configuration);
    ...
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            app.UseKongRegisterController();
			...
        }

Run your application, OK it's registered in your Kong server !<br/> Shutdown it, it's now unregistered from Kong !

Compatibility

KongRegister is compatible with:

  • Kong CE 0.13.x, 0.14.x
  • .Net Core 3.1

Prerequisites

  • A running Kong installation
  • A .Net Core 3.1 web application

Discussions & Support

You can get help via the issue tracker here on GitHub

Features

  • Auto register in Kong server on startup
  • Auto unregister from Kong server on shutdown
  • Manual register in Kong via an HTTP request
  • Manual unregister in Kong via an HTTP request
  • Auto discover host IP
  • Auto discover host port

Installation

You must install KongRegister from NuGet.

*Package manager 😗

Install-Package KongRegister

*.Net CLI 😗

dotnet add package KongRegister

Configuration

The configuration must be define in the appsettings.json under a root section that you can named it as you choice.

*Example 😗

"KongRegister": {
    "OnStartup" : true,
    "KongApiUrl": "http://YourKongApiUrl:8081",
    "KongApiKeyHeader": "YourApikeyHeader",
    "KongApiKey": "YourApiKey",
    "UpstreamId": "YourUpstreamId",
    "TargetHostDiscovery": "dynamic",
    "TargetHost": "YourTargetHostNameOrIp",
    "TargetPortDiscovery": "dynamic",
    "TargetPort": 5000,
    "TargetWeight": 1000
  }

Or define in environments variables in uppercase and start with KR_ followed by a parameter name. Like KR_ONSTARTUP=True.

See below all detailed parameters :

Parameter Type Description
Disabled Boolean Disble KongRegister service.
OnStratup Boolean Enable registering on startup.
KongApiUrl String Url of your Kong Admin Api. Don't forget the port if it's not standard (80 or 443).
KongApiKeyHeader String Name of your header that contain your API Key (if your Kong server is secured).
KongApiKey String Your API Key (if your Kong server is secured).
UpstreamId String Kong Upstream Id that you want to register your application into.
TargetHostDiscovery String Discovery method for your application host. Value must be dynamic or static.
TargetHost String Host name or IP of your application host. (if discovery method is static).
TargetPortDiscovery String Discovery method for your application host port. Value must be dynamic or static.
TargetPort Integer Port of your application host (if discovery method is static).
TargetWeight Integer Weight for the registered target in Kong server.

Running

Todo

using KongRegister;
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp3.1 is compatible. 
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
3.0.0 44,053 12/31/2019
2.0.2 1,642 11/21/2018
2.0.1 777 9/20/2018
2.0.0 958 5/24/2018
1.1.2 888 5/22/2018
1.1.1 827 5/22/2018
1.1.0 849 5/22/2018
1.0.8 921 4/5/2018
1.0.7 966 4/3/2018
1.0.5 930 3/28/2018

KongRegister v3.0.0
Migrate to dotnet core 3.1