mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
fix: 🐞 resolve some warnings as errors
This commit is contained in:
parent
00a5f7bc5f
commit
c5d5f8b5ea
6 changed files with 31 additions and 20 deletions
|
|
@ -11,16 +11,18 @@ internal static class ConfigurationExtensions
|
|||
public static void AddPersistence(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.Configure<GitOptions>(configuration.GetSection(GitOptions.Key));
|
||||
services.AddTransient<IRepository, Repository>(_ =>
|
||||
{
|
||||
var gitOptions = configuration.GetSection(GitOptions.Key).Get<GitOptions>();
|
||||
if (!Repository.IsValid(gitOptions.RepositoryPath))
|
||||
services.AddTransient<IRepository, Repository>(
|
||||
_ =>
|
||||
{
|
||||
Repository.Init(gitOptions.RepositoryPath);
|
||||
}
|
||||
var gitOptions = configuration.GetSection(GitOptions.Key)
|
||||
.Get<GitOptions>();
|
||||
if (!Repository.IsValid(gitOptions?.RepositoryPath))
|
||||
{
|
||||
Repository.Init(gitOptions?.RepositoryPath);
|
||||
}
|
||||
|
||||
return new Repository(gitOptions.RepositoryPath);
|
||||
});
|
||||
return new Repository(gitOptions?.RepositoryPath);
|
||||
});
|
||||
services.AddTransient<IListArchiveRepository, GitListArchiveRepository>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,11 @@ internal static class ConfigurationExtensions
|
|||
|
||||
public static void AddScheduling(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
_redis = ConnectionMultiplexer.Connect(configuration.GetConnectionString("SchedulingConnection"));
|
||||
services.AddHangfire((_, globalConfiguration) => globalConfiguration.UseRedisStorage(_redis).UseMediatR());
|
||||
_redis = ConnectionMultiplexer.Connect(
|
||||
configuration.GetConnectionString("SchedulingConnection") ?? string.Empty);
|
||||
services.AddHangfire(
|
||||
(_, globalConfiguration) => globalConfiguration.UseRedisStorage(_redis)
|
||||
.UseMediatR());
|
||||
services.AddHangfireServer(o => o.WorkerCount = Environment.ProcessorCount);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,15 +12,17 @@ public static void AddDirectoryApiClient(this IServiceCollection services, IConf
|
|||
{
|
||||
// TODO: use SystemTextJsonContentSerializer() once less feature-limited
|
||||
services.AddRefitClient<IDirectoryApi>()
|
||||
.ConfigureHttpClient(c =>
|
||||
{
|
||||
var host = configuration.GetSection(ApiOptions.Key).Get<ApiOptions>().DirectoryHost;
|
||||
c.BaseAddress = new UriBuilder("http", host).Uri;
|
||||
})
|
||||
.AddTransientHttpErrorPolicy(b =>
|
||||
b.WaitAndRetryAsync(new[]
|
||||
.ConfigureHttpClient(
|
||||
c =>
|
||||
{
|
||||
TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10)
|
||||
}));
|
||||
var host = configuration.GetSection(ApiOptions.Key)
|
||||
.Get<ApiOptions>()
|
||||
?.DirectoryHost;
|
||||
c.BaseAddress = new UriBuilder("http", host).Uri;
|
||||
})
|
||||
.AddTransientHttpErrorPolicy(
|
||||
b =>
|
||||
b.WaitAndRetryAsync(
|
||||
new[] { TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10) }));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ internal class CommandDbContext : DbContext, ICommandContext
|
|||
{
|
||||
static CommandDbContext()
|
||||
{
|
||||
#pragma warning disable CS0618
|
||||
NpgsqlConnection.GlobalTypeMapper.MapEnum<AggregateType>();
|
||||
#pragma warning restore CS0618
|
||||
}
|
||||
|
||||
public CommandDbContext(DbContextOptions<CommandDbContext> options) : base(options) { }
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ public class QueryDbContext : DbContext
|
|||
{
|
||||
static QueryDbContext()
|
||||
{
|
||||
#pragma warning disable CS0618
|
||||
NpgsqlConnection.GlobalTypeMapper.MapEnum<AggregateType>();
|
||||
#pragma warning restore CS0618
|
||||
}
|
||||
|
||||
public QueryDbContext(DbContextOptions<QueryDbContext> options) : base(options) { }
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public static void AddSharedKernelLogging(this IServiceCollection services, ICon
|
|||
{
|
||||
StorageFolder = configuration.GetSection(ApplicationInsightsOptions.Key)
|
||||
.Get<ApplicationInsightsOptions>()
|
||||
.ServerTelemetryChannelStoragePath
|
||||
?.ServerTelemetryChannelStoragePath
|
||||
};
|
||||
services.AddSingleton(typeof(ITelemetryChannel), serverTelemetryChannel);
|
||||
TelemetryDebugWriter.IsTracingDisabled = true;
|
||||
|
|
|
|||
Loading…
Reference in a new issue