sunpengfei
昨天 8cc3bff6979c8e3d66e9d4caa91398c3f0e58f0a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using Consul;
using Furion;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace FlexJobApi.Core
{
    public class ConsulServiceComponent : IServiceComponent
    {
        public void Load(IServiceCollection services, ComponentContext componentContext)
        {
            services.AddSingleton<IConsulClient, ConsulClient>(p => new ConsulClient(config =>
            {
                var address = App.Configuration["Consul:Address"] ?? "http://localhost:8500";
                config.Address = new Uri(address);
            }));
        }
    }
}