|
|
@ -1,5 +1,6 @@
|
|
|
|
using Connected.Interop;
|
|
|
|
using Connected.Interop;
|
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
|
|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Connected.Instance
|
|
|
|
namespace Connected.Instance
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -7,9 +8,13 @@ namespace Connected.Instance
|
|
|
|
{
|
|
|
|
{
|
|
|
|
internal static WebApplication Host { get; private set; }
|
|
|
|
internal static WebApplication Host { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
internal static async Task StartAsync(Dictionary<string, string> args)
|
|
|
|
internal static async Task StartAsync(IConfiguration config)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var builder = WebApplication.CreateBuilder(UnpackArguments(args));
|
|
|
|
var options = new WebApplicationOptions();
|
|
|
|
|
|
|
|
config.Bind(options);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var builder = WebApplication.CreateBuilder(options);
|
|
|
|
|
|
|
|
|
|
|
|
var startups = Assemblies.QueryImplementations<IStartup>();
|
|
|
|
var startups = Assemblies.QueryImplementations<IStartup>();
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var assembly in Assemblies.All)
|
|
|
|
foreach (var assembly in Assemblies.All)
|
|
|
@ -32,16 +37,16 @@ namespace Connected.Instance
|
|
|
|
foreach (var startup in startups)
|
|
|
|
foreach (var startup in startups)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (startup.CreateInstance<IStartup>() is IStartup start)
|
|
|
|
if (startup.CreateInstance<IStartup>() is IStartup start)
|
|
|
|
await start.Initialize(args);
|
|
|
|
await start.Initialize(config);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var startup in startups)
|
|
|
|
foreach (var startup in startups)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (startup.CreateInstance<IStartup>() is IStartup start)
|
|
|
|
if (startup.CreateInstance<IStartup>() is IStartup start)
|
|
|
|
await start.Start(args);
|
|
|
|
await start.Start(config);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (args.TryGetValue("entitySynchronization", out string? entities))
|
|
|
|
if (config.GetValue<string?>("entitySynchronization") is string entities)
|
|
|
|
await EntitySynchronizer.Synchronize(Host.Services, entities);
|
|
|
|
await EntitySynchronizer.Synchronize(Host.Services, entities);
|
|
|
|
|
|
|
|
|
|
|
|
await Host.RunAsync();
|
|
|
|
await Host.RunAsync();
|
|
|
|