mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
strip out old deps, add git and command line helper nugets
This commit is contained in:
parent
018aa2a733
commit
1625fb4e69
3 changed files with 4 additions and 110 deletions
|
|
@ -27,17 +27,10 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.7.1" />
|
||||
<PackageReference Include="CommandLineParser" Version="2.5.0" />
|
||||
<PackageReference Include="LibGit2Sharp" Version="0.26.0" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.3" />
|
||||
<PackageReference Include="Microsoft.DotNet.Analyzers.Compatibility" Version="0.2.12-alpha" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FilterLists.Services\FilterLists.Services.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,75 +1,9 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using FilterLists.Services;
|
||||
using FilterLists.Services.DependencyInjection.Extensions;
|
||||
using FilterLists.Services.Extensions;
|
||||
using FilterLists.Services.Snapshot;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace FilterLists.Agent
|
||||
namespace FilterLists.Agent
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
private const int BatchSize = 1;
|
||||
private static IConfigurationRoot configRoot;
|
||||
private static ServiceProvider serviceProvider;
|
||||
private static SnapshotService snapshotService;
|
||||
private static Logger logger;
|
||||
private static readonly TimeSpan Timeout = TimeSpan.FromDays(7);
|
||||
|
||||
public static async Task Main()
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
BuildConfigRoot();
|
||||
BuildServiceProvider();
|
||||
snapshotService = serviceProvider.GetService<SnapshotService>();
|
||||
logger = serviceProvider.GetService<Logger>();
|
||||
await TryCaptureSnapshots();
|
||||
}
|
||||
|
||||
private static void BuildConfigRoot() =>
|
||||
configRoot = new ConfigurationBuilder()
|
||||
.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddJsonFile("appsettings.json", false)
|
||||
.Build();
|
||||
|
||||
private static void BuildServiceProvider()
|
||||
{
|
||||
var serviceCollection = new ServiceCollection();
|
||||
serviceCollection.AddFilterListsAgentServices(configRoot);
|
||||
serviceProvider = serviceCollection.BuildServiceProvider();
|
||||
}
|
||||
|
||||
private static async Task TryCaptureSnapshots()
|
||||
{
|
||||
try
|
||||
{
|
||||
await CaptureSnapshots(BatchSize).TimeoutAfter(Timeout);
|
||||
}
|
||||
catch (TimeoutException te)
|
||||
{
|
||||
logger.Log(te);
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task CaptureSnapshots(int batchSize)
|
||||
{
|
||||
logger.Log("Capturing FilterList snapshots...");
|
||||
await TryCaptureAsync(batchSize);
|
||||
logger.Log("Snapshots captured.");
|
||||
}
|
||||
|
||||
private static async Task TryCaptureAsync(int batchSize)
|
||||
{
|
||||
try
|
||||
{
|
||||
await snapshotService.CaptureAsync(batchSize);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.Log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
WARNING - This file will be checked into source control. Do not change this file.
|
||||
Use this as an example file only.
|
||||
Use {env.EnvironmentName}.json as your configuration file as it will not be checked into source control.
|
||||
{env.EnvironmentName} values : development, staging, production
|
||||
*/
|
||||
{
|
||||
"ApplicationInsights": {
|
||||
"InstrumentationKey": ""
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"FilterListsConnection": ""
|
||||
},
|
||||
"Logging": {
|
||||
"IncludeScopes": false,
|
||||
"LogLevel": {
|
||||
"Default": "Debug",
|
||||
"System": "Information",
|
||||
"Microsoft": "Information"
|
||||
}
|
||||
},
|
||||
"SendGrid": {
|
||||
"ApiKey": "",
|
||||
"From": {
|
||||
"Name": "",
|
||||
"EmailAddress": ""
|
||||
},
|
||||
"To": {
|
||||
"Name": "",
|
||||
"EmailAddress": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue