Add option to specify hostname in BrowserRefreshServer (#25572)

* Add option to specify hostName for refresh server

* Update env variable name per suggestion

Co-authored-by: Pranav K <prkrishn@hotmail.com>

Co-authored-by: Pranav K <prkrishn@hotmail.com>
This commit is contained in:
Zachary Becknell 2020-09-10 18:10:47 -04:00 committed by GitHub
parent cc0665cb6f
commit fa2a5076e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -33,11 +33,13 @@ namespace Microsoft.DotNet.Watcher.Tools
public async ValueTask<string> StartAsync(CancellationToken cancellationToken) public async ValueTask<string> StartAsync(CancellationToken cancellationToken)
{ {
var hostName = Environment.GetEnvironmentVariable("DOTNET_WATCH_AUTO_RELOAD_WS_HOSTNAME") ?? "127.0.0.1";
_refreshServer = new HostBuilder() _refreshServer = new HostBuilder()
.ConfigureWebHost(builder => .ConfigureWebHost(builder =>
{ {
builder.UseKestrel(); builder.UseKestrel();
builder.UseUrls("http://127.0.0.1:0"); builder.UseUrls($"http://{hostName}:0");
builder.Configure(app => builder.Configure(app =>
{ {