Skip to content

Common Service Discovery class library with Consul. This class library can be published as a Nuget or can be referenced directly in the project.

License

Notifications You must be signed in to change notification settings

bm1905/ServiceDiscovery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ServiceDiscovery with Consul

Common Service Discovery class library with Consul. This class library can be published as a Nuget or can be referenced directly in the project.

Build Status

Usage

In Startup.cs file, use the following code snippet.

public class Startup
{
    private readonly IConfiguration _config;

    public Startup(IConfiguration config)
    {
        _config = config;
    }

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddServiceDiscovery(config);
    }

    private static void AddServiceDiscovery(this IServiceCollection services, IConfiguration config)
    {
        ServiceConfig serviceConfig = config.GetServiceConfig();
        services.RegisterConsulServices(serviceConfig);
    }
}

Then add the following to the configuration file appsettings.YOUR ENV.json

"ServiceConfig": {
    "ServiceDiscoveryAddress": "https://URL",
    "ServiceName": "unique-service-name",
    "ServiceId": "unique-service-id",
    "ServiceAddress": "https://URL"
}

About

Common Service Discovery class library with Consul. This class library can be published as a Nuget or can be referenced directly in the project.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages