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:
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user