2022-12-31 13:31:42 +00:00
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using ReInject;
|
2023-01-02 11:26:21 +00:00
|
|
|
|
using Server;
|
2022-12-26 09:34:31 +00:00
|
|
|
|
|
2022-12-31 13:31:42 +00:00
|
|
|
|
var services = Injector.GetContainer();
|
|
|
|
|
|
|
|
|
|
var configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
|
|
|
|
|
|
|
|
|
|
services.Register<IConfiguration>(DependencyStrategy.AtomicInstance, true, configuration);
|
|
|
|
|
|
|
|
|
|
ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
|
|
|
|
|
{
|
|
|
|
|
builder.AddSimpleConsole(options =>
|
|
|
|
|
{
|
|
|
|
|
options.ColorBehavior = Microsoft.Extensions.Logging.Console.LoggerColorBehavior.Enabled;
|
|
|
|
|
options.TimestampFormat = "[HH:mm:ss]";
|
2022-12-31 16:30:27 +00:00
|
|
|
|
options.IncludeScopes = true;
|
2022-12-31 13:31:42 +00:00
|
|
|
|
});
|
|
|
|
|
builder.AddFile("Logs/log-{0:yyyy}-{0:MM}-{0:dd}.txt",
|
|
|
|
|
opts => opts.FormatLogFileName = fileName => String.Format(fileName, DateTime.UtcNow));
|
|
|
|
|
});
|
|
|
|
|
|
2023-01-02 11:26:21 +00:00
|
|
|
|
services.Register<AesProvider>(DependencyStrategy.AtomicInstance, true, new AesProvider(loggerFactory, null, null));
|
2022-12-31 13:31:42 +00:00
|
|
|
|
services.Register<ILoggerFactory>(DependencyStrategy.AtomicInstance, true, loggerFactory);
|
|
|
|
|
|
2023-01-02 11:26:21 +00:00
|
|
|
|
var authServer = services.GetInstance<AuthorizationServer>();
|
2022-12-31 13:31:42 +00:00
|
|
|
|
authServer.Start();
|