94 lines
2.9 KiB
C#
94 lines
2.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.AspNetCore.HttpsPolicy;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Microsoft.Extensions.Logging;
|
|
using Repositories;
|
|
using Repositories.Interfaces;
|
|
using BusinessLogic.LookupLogic;
|
|
using BusinessLogic.LookupLogic.Interfaces;
|
|
using SearchLogic;
|
|
using OpenTelemetry.Exporter;
|
|
using OpenTelemetry.Instrumentation.AspNetCore;
|
|
using OpenTelemetry.Resources;
|
|
using OpenTelemetry.Trace;
|
|
using Elastic.Apm.AspNetCore;
|
|
using Elastic.Apm.EntityFrameworkCore;
|
|
using Elastic.Apm;
|
|
|
|
namespace FwSearchApi
|
|
{
|
|
public class Startup
|
|
{
|
|
|
|
readonly ILogger<Startup> _logger;
|
|
public IConfiguration _configuration { get; }
|
|
|
|
public Startup(IConfiguration configuration)
|
|
{
|
|
_configuration = configuration;
|
|
|
|
}
|
|
|
|
// This method gets called by the runtime. Use this method to add services to the container.
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddControllers().AddNewtonsoftJson((options) =>
|
|
{
|
|
// keine Optionen hier
|
|
});
|
|
|
|
services.AddTransient<ILookupLogic, FwLookupLogic>();
|
|
services.AddTransient<IFwMariaLookupRepo, FwMariaLookupRepo>();
|
|
services.AddTransient<IFwMariaSearchRepo, FwMariaSearchRepo>();
|
|
services.AddTransient<ISearchLogic, SearchLogic.SearchLogic>();
|
|
services.AddSwaggerGen();
|
|
|
|
services.AddOpenTelemetryTracing((builder) => builder
|
|
.AddAspNetCoreInstrumentation()
|
|
.AddHttpClientInstrumentation()
|
|
.AddConsoleExporter()
|
|
.AddOtlpExporter(otlpOptions => {
|
|
otlpOptions.Endpoint = new Uri("http://192.168.178.44:8200");
|
|
}));
|
|
|
|
|
|
|
|
}
|
|
|
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
|
{
|
|
if (env.IsDevelopment())
|
|
{
|
|
app.UseDeveloperExceptionPage();
|
|
}
|
|
|
|
app.UseSwagger();
|
|
|
|
app.UseElasticApm(_configuration, new EfCoreDiagnosticsSubscriber());
|
|
|
|
app.UseSwaggerUI(c =>
|
|
{
|
|
c.SwaggerEndpoint("/swagger/v1/swagger.json", "FeatureWerk Search API V1");
|
|
});
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.UseRouting();
|
|
|
|
app.UseEndpoints(endpoints =>
|
|
{
|
|
endpoints.MapControllers();
|
|
});
|
|
}
|
|
}
|
|
}
|