Add command line parameters

Add debugger wait
This commit is contained in:
Matija Koželj 2023-01-04 15:52:45 +01:00
parent 3e01ffbe51
commit 3ff30ea1fd
3 changed files with 10 additions and 2 deletions

View File

@ -1,4 +1,5 @@
using System.Reflection;
using System.Diagnostics;
using System.Reflection;
using Connected.Host.Configuration;
using Microsoft.Extensions.Options;
@ -16,6 +17,10 @@ internal sealed class ConnectedPlatformService : BackgroundService
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
if (GlobalConfig.GetValue<bool>("waitForDebugger"))
while (!Debugger.IsAttached)
await Task.Delay(500);
await DependencyLoader.LoadPackages(Config.MicroServices, Config.Repositories);
if (Type.GetType(Config.Start) is not Type startupType)

View File

@ -11,6 +11,8 @@ namespace Connected.Host
.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((_, cfg) =>
{
cfg.AddCommandLine(args);
var appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var segments = new Uri(appPath).Segments;

View File

@ -25,5 +25,6 @@
"version": "1.0.*-*"
}
],
"start": "Connected.Instance.Start, Connected.Instance"
"start": "Connected.Instance.Start, Connected.Instance",
"waitForDebugger": true
}