Add command line parameters
Add debugger wait
This commit is contained in:
parent
3e01ffbe51
commit
3ff30ea1fd
@ -1,4 +1,5 @@
|
|||||||
using System.Reflection;
|
using System.Diagnostics;
|
||||||
|
using System.Reflection;
|
||||||
using Connected.Host.Configuration;
|
using Connected.Host.Configuration;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
|
||||||
@ -16,6 +17,10 @@ internal sealed class ConnectedPlatformService : BackgroundService
|
|||||||
|
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
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);
|
await DependencyLoader.LoadPackages(Config.MicroServices, Config.Repositories);
|
||||||
|
|
||||||
if (Type.GetType(Config.Start) is not Type startupType)
|
if (Type.GetType(Config.Start) is not Type startupType)
|
||||||
|
@ -11,6 +11,8 @@ namespace Connected.Host
|
|||||||
.CreateDefaultBuilder(args)
|
.CreateDefaultBuilder(args)
|
||||||
.ConfigureAppConfiguration((_, cfg) =>
|
.ConfigureAppConfiguration((_, cfg) =>
|
||||||
{
|
{
|
||||||
|
cfg.AddCommandLine(args);
|
||||||
|
|
||||||
var appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
var appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||||
var segments = new Uri(appPath).Segments;
|
var segments = new Uri(appPath).Segments;
|
||||||
|
|
||||||
|
@ -25,5 +25,6 @@
|
|||||||
"version": "1.0.*-*"
|
"version": "1.0.*-*"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"start": "Connected.Instance.Start, Connected.Instance"
|
"start": "Connected.Instance.Start, Connected.Instance",
|
||||||
|
"waitForDebugger": true
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user