-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathRunCommand.cs
More file actions
43 lines (37 loc) · 1.66 KB
/
RunCommand.cs
File metadata and controls
43 lines (37 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
namespace ServiceControl.Hosting.Commands
{
using System.Threading.Tasks;
using Infrastructure.WebApi;
using Microsoft.AspNetCore.Builder;
using NServiceBus;
using Particular.ServiceControl;
using Particular.ServiceControl.Hosting;
using ServiceBus.Management.Infrastructure.Settings;
using ServiceControl;
using ServiceControl.Hosting.Auth;
using ServiceControl.Hosting.Https;
using ServicePulse;
class RunCommand : AbstractCommand
{
public override async Task Execute(HostArguments args, Settings settings)
{
var endpointConfiguration = new EndpointConfiguration(settings.InstanceName);
var assemblyScanner = endpointConfiguration.AssemblyScanner();
assemblyScanner.ExcludeAssemblies("ServiceControl.Plugin");
settings.RunCleanupBundle = true;
var hostBuilder = WebApplication.CreateBuilder();
hostBuilder.AddServiceControlAuthentication(settings.OpenIdConnectSettings);
hostBuilder.AddServiceControlHttps(settings.HttpsSettings);
hostBuilder.AddServiceControl(settings, endpointConfiguration);
hostBuilder.AddServiceControlApi(settings);
var app = hostBuilder.Build();
app.UseServiceControl(settings.ForwardedHeadersSettings, settings.HttpsSettings, settings.EnableMcpServer);
if (settings.EnableIntegratedServicePulse)
{
app.UseServicePulse(settings.ServicePulseSettings);
}
app.UseServiceControlAuthentication(settings.OpenIdConnectSettings.Enabled);
await app.RunAsync(settings.RootUrl);
}
}
}