/// <summary>
        /// Adds Kong Client to the specified Microsoft.Extensions.DependencyInjection.IServiceCollection.
        /// </summary>
        /// <param name="service"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public static IServiceCollection AddKong(this IServiceCollection service, KongClientOptions options)
        {
            KongClient client = new KongClient(options);

            service.AddSingleton <KongClient>(fat => client);
            return(service);
        }
Exemple #2
0
        public GatewayProvider SettingKongService(AppConfig appConfig)
        {
            if (string.IsNullOrEmpty(appConfig.Gateway.KongAddress))
            {
                return(this);
            }

            var options = new KongClientOptions(httpClient: new System.Net.Http.HttpClient(), host: $"http://{appConfig.Gateway.KongAddress}");
            var client  = new KongClient(options);

            var service = new ServiceInfo
            {
                Name            = appConfig.Gateway.Name,
                Id              = Guid.NewGuid(),
                Port            = appConfig.Gateway.Port,
                Protocol        = appConfig.Gateway.Protocol,
                Path            = appConfig.Gateway.Path,
                Tags            = new string[] { appConfig.Gateway.Name },
                Host            = appConfig.Gateway.Address,
                Connect_timeout = 60000,
                Read_timeout    = 60000,
                Write_timeout   = 60000,
            };

            client.Service?.UpdateOrCreate(service);

            SettingAuthSerice(appConfig, client);

            return(this);
        }
Exemple #3
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddKong(() =>
     {
         var options = new KongClientOptions(HttpClientFactory.Create(), this.Configuration["kong:host"]);
         return(options);
     });
     services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
 }
Exemple #4
0
 public ServiceApi(KongClientOptions options) : base(options)
 {
 }
Exemple #5
0
 public PluginApi(KongClientOptions options) : base(options)
 {
 }
Exemple #6
0
 protected BaseApi(KongClientOptions kongOptions)
 {
     this.kongOptions = kongOptions;
 }
 public CertificateApi(KongClientOptions options) : base(options)
 {
 }
Exemple #8
0
 public ConsumerApi(KongClientOptions options) : base(options)
 {
 }
Exemple #9
0
 public KongClient(KongClientOptions options)
 {
     this.options = options;
 }
Exemple #10
0
        public BaseTest()
        {
            var options = new KongClientOptions(httpClient: new System.Net.Http.HttpClient(), host: "http://172.16.1.243:8001");

            client = new KongClient(options);
        }
Exemple #11
0
 public NodeApi(KongClientOptions options) : base(options)
 {
 }
Exemple #12
0
 public TargetApi(KongClientOptions options) : base(options)
 {
 }
Exemple #13
0
 public RouteApi(KongClientOptions options) : base(options)
 {
 }
Exemple #14
0
 public UpStreamApi(KongClientOptions options) : base(options)
 {
 }
Exemple #15
0
 public SNIApi(KongClientOptions options) : base(options)
 {
 }
Exemple #16
0
 public TagsApi(KongClientOptions options) : base(options)
 {
 }