-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathStartup.cs
More file actions
45 lines (39 loc) · 1.35 KB
/
Startup.cs
File metadata and controls
45 lines (39 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace Fnproject.Fn.Fdk
{
internal class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddLogging(
builder =>
{
builder
.AddFilter("Microsoft", LogLevel.Warning)
.AddFilter("System", LogLevel.Warning)
.AddFilter("NToastNotify", LogLevel.Warning)
.AddConsole();
});
}
public void Configure(IApplicationBuilder app, IHostApplicationLifetime applicationLifetime)
{
app.UseRouting();
// Middleware for Logging
app.Use(async (context, next) =>
{
Logger.Start(context.Request.Headers);
await next.Invoke();
});
app.UseMiddleware<Middleware>();
applicationLifetime.ApplicationStarted.Register(() =>
{
Server.SocketPermissions(Server.PHONY_SOCKET_PATH, Server.SOCKET_PATH);
});
}
}
}