1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-11 12:53:50 -05:00

port events processor over to webjobs sdk 3

This commit is contained in:
Kyle Spearrin
2019-02-26 11:31:37 -05:00
parent d6eeca3138
commit 0e756208e8
6 changed files with 71 additions and 39 deletions

View File

@ -1,21 +1,40 @@
using Microsoft.Azure.WebJobs;
using System;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace Bit.EventsProcessor
{
public class Program
class Program
{
private static void Main()
static void Main(string[] args)
{
var config = new JobHostConfiguration();
if(config.IsDevelopment)
var builder = new HostBuilder();
builder.ConfigureWebJobs(b =>
{
config.UseDevelopmentSettings();
b.AddAzureStorageCoreServices();
b.AddAzureStorage(a =>
{
a.BatchSize = 5;
});
// Not working. ref: https://github.com/Azure/azure-webjobs-sdk/issues/1962
b.AddDashboardLogging();
});
builder.ConfigureLogging((context, b) =>
{
b.AddConsole();
b.SetMinimumLevel(LogLevel.Warning);
});
builder.ConfigureHostConfiguration(b =>
{
b.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
b.AddEnvironmentVariables();
});
var host = builder.Build();
using(host)
{
host.Run();
}
config.Queues.BatchSize = 5;
var host = new JobHost(config);
host.RunAndBlock();
}
}
}