Exemplo n.º 1
0
        public static IApplicationBuilder UseTomatoLog(this IApplicationBuilder app,
                                                       IConfiguration configuration,
                                                       IDistributedCache cache,
                                                       SysConfigManager sysManager,
                                                       ProConfigManager proManager,
                                                       IApplicationLifetime lifetime)
        {
            lifeTime         = lifetime;
            sysConfigManager = sysManager;
            filterService    = new FilterService(configuration, cache, sysManager, proManager, logger);
            var flowType = configuration.GetSection("TomatoLog:Flow:Type").Get <FlowType>();

            switch (flowType)
            {
            default:
                UseRedis(configuration, cache);
                break;

            case FlowType.RabbitMQ:
                UseRabbitMQ(configuration);
                break;

            case FlowType.Kafka:
                UseKafka(configuration);
                break;
            }
            return(app);
        }
Exemplo n.º 2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,
                              IHostingEnvironment env,
                              ILoggerFactory factory,
                              IDistributedCache cache,
                              SysConfigManager sysConfig,
                              ProConfigManager proConfig,
                              IApplicationLifetime lifetime)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }
            app.UseStaticFiles();
            app.UseTomatoLog(this.Configuration, cache, sysConfig, proConfig, lifetime);

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
Exemplo n.º 3
0
 public ProConfigController(ProConfigManager proManager, IConfiguration cfg, ILogger <ConfigController> logger) : base(cfg, logger)
 {
     this.proManager = proManager;
     if (proManager.ConfigObject == null)
     {
         proManager.ConfigObject = new List <ReportViewModel>();
     }
 }
Exemplo n.º 4
0
 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
 public void Configure(IApplicationBuilder app, IWebHostEnvironment env, HttpClient httpClient, IDistributedCache cache,
                       SysConfigManager sysConfig,
                       ProConfigManager proConfig,
                       IHostApplicationLifetime lifetime)
 {
     if (env.IsDevelopment())
     {
         app.UseDeveloperExceptionPage();
     }
     else
     {
         app.UseExceptionHandler("/Home/Error");
     }
     app.UseStaticFiles();
     app.UseRouting();
     app.UseAuthorization();
     app.UseTomatoLog(this.Configuration, cache, sysConfig, proConfig, lifetime, httpClient);
     app.UseEndpoints(endpoints =>
     {
         endpoints.MapControllerRoute(
             name: "default",
             pattern: "{controller=Home}/{action=Index}/{id?}");
     });
 }