Add Proxy Support, Add IOptions Pattern, Add Extensions Method
Currently Changes Http / Https proxy support has been added , To disguise the Ip address or if a proxy service is required IOptions pattern has been implemented. Better options handling Extensions methods have been implemented to make Program.cs smaller Added a global logger for static and extension methods appsettings.json now contains "default" data for the applications and proxy settings. The Docker variables are also specified above it. This also fixes the bug that you have to set all variables, although you only want to use Sonarr, for example
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Net;
|
||||
using UmlautAdaptarr.Options;
|
||||
using UmlautAdaptarr.Providers;
|
||||
using UmlautAdaptarr.Routing;
|
||||
using UmlautAdaptarr.Services;
|
||||
using UmlautAdaptarr.Utilities;
|
||||
|
||||
internal class Program
|
||||
{
|
||||
@@ -24,6 +26,8 @@ internal class Program
|
||||
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate | DecompressionMethods.Brotli
|
||||
};
|
||||
|
||||
var proxyOptions = configuration.GetSection("Proxy").Get<ProxyOptions>();
|
||||
handler.ConfigureProxy(proxyOptions);
|
||||
return handler;
|
||||
});
|
||||
|
||||
@@ -46,17 +50,18 @@ internal class Program
|
||||
|
||||
builder.Services.AddControllers();
|
||||
builder.Services.AddHostedService<ArrSyncBackgroundService>();
|
||||
builder.Services.AddSingleton<TitleApiService>();
|
||||
builder.AddTitleLookupService();
|
||||
builder.Services.AddSingleton<SearchItemLookupService>();
|
||||
builder.Services.AddSingleton<TitleMatchingService>();
|
||||
builder.Services.AddSingleton<SonarrClient>();
|
||||
builder.Services.AddSingleton<LidarrClient>();
|
||||
builder.Services.AddSingleton<ReadarrClient>();
|
||||
builder.AddSonarrSupport();
|
||||
builder.AddLidarrSupport();
|
||||
builder.AddReadarrSupport();
|
||||
builder.Services.AddSingleton<CacheService>();
|
||||
builder.Services.AddSingleton<ProxyService>();
|
||||
builder.AddProxyService();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
GlobalStaticLogger.Initialize(app.Services.GetService<ILoggerFactory>()!);
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
Reference in New Issue
Block a user