88 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			88 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| 
 | |
| using Microsoft.AspNetCore.Builder;
 | |
| using Microsoft.AspNetCore.Hosting;
 | |
| using Microsoft.Extensions.Configuration;
 | |
| using Microsoft.Extensions.DependencyInjection;
 | |
| using Microsoft.Extensions.Hosting;
 | |
| using Microsoft.Extensions.Logging;
 | |
| 
 | |
| using BusinessLogic.LookupLogic;
 | |
| using BusinessLogic.LookupLogic.Interfaces;
 | |
| 
 | |
| using OpenTelemetry.Resources;
 | |
| using OpenTelemetry.Trace;
 | |
| 
 | |
| using Repositories;
 | |
| using Repositories.Interfaces;
 | |
| 
 | |
| using SearchApi.SearchLogic;
 | |
| 
 | |
| 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>();
 | |
|             services.AddSwaggerGen();
 | |
|         	AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);  //needed if no Security is used when calling APM Server
 | |
|             services.AddOpenTelemetryTracing((builder) => builder
 | |
|                         .SetResourceBuilder(ResourceBuilder.CreateDefault().AddService("TxSearchApi"))
 | |
|                         .AddAspNetCoreInstrumentation()
 | |
|                         .AddHttpClientInstrumentation()
 | |
|                         .AddEntityFrameworkCoreInstrumentation(o => o.SetDbStatementForText = true) //logging of Statement as Span
 | |
|                         .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.UseSwaggerUI(c =>
 | |
|             {
 | |
|                 c.SwaggerEndpoint("/swagger/v1/swagger.json", "FeatureWerk Search API V1");
 | |
|             });
 | |
| 
 | |
|             app.UseHttpsRedirection();
 | |
| 
 | |
|             app.UseRouting();
 | |
| 
 | |
|             app.UseEndpoints(endpoints =>
 | |
|             {
 | |
|                 endpoints.MapControllers();
 | |
|             });
 | |
|         }
 | |
|     }
 | |
| }
 |