-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
51 lines (49 loc) · 1.76 KB
/
Copy pathProgram.cs
File metadata and controls
51 lines (49 loc) · 1.76 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
44
45
46
47
48
49
50
51
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
namespace FreshBoard
{
public static class WebBuilderExtensions
{
public static IWebHostBuilder UseSystemfdLiveReload(this IWebHostBuilder builder)
{
if (Environment.OSVersion.Platform == PlatformID.Win32NT) return builder;
return builder
#region systemfd
#if DEBUG
// systemfd debug support, only on Unix system
// run the following command to get continous
// socket listening
// systemfd --no-pid -s http::5000 -- dotnet watch run
// enable libuv to support ListenHandle
.UseLibuv()
.ConfigureKestrel(serverOptions =>
{
// detect systemfd environment
var fds = Environment.GetEnvironmentVariable("LISTEN_FDS");
if (fds != null)
// listen to given file handle
// file handle begins at 3
serverOptions.ListenHandle(3);
})
#endif
#endregion
;
}
}
public class Program
{
public static Task Main(string[] args) =>
CreateHostBuilder(args).Build().RunAsync();
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host
.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder
.UseSystemfdLiveReload()
.UseStartup<Startup>();
});
}
}