Support specifying environment variables for the Webpack dev middleware Node instance. Resolves #311.

This commit is contained in:
SteveSandersonMS
2016-11-07 12:29:01 -08:00
parent 2c97326721
commit fadcb586c6
2 changed files with 11 additions and 0 deletions

View File

@@ -47,6 +47,14 @@ namespace Microsoft.AspNetCore.Builder
nodeServicesOptions.ProjectPath = options.ProjectPath;
}
if (options.EnvironmentVariables != null)
{
foreach (var kvp in options.EnvironmentVariables)
{
nodeServicesOptions.EnvironmentVariables[kvp.Key] = kvp.Value;
}
}
var nodeServices = NodeServicesFactory.CreateNodeServices(nodeServicesOptions);
// Get a filename matching the middleware Node script

View File

@@ -1,3 +1,5 @@
using System.Collections.Generic;
namespace Microsoft.AspNetCore.SpaServices.Webpack
{
public class WebpackDevMiddlewareOptions
@@ -7,5 +9,6 @@ namespace Microsoft.AspNetCore.SpaServices.Webpack
public bool ReactHotModuleReplacement { get; set; }
public string ConfigFile { get; set; }
public string ProjectPath { get; set; }
public IDictionary<string, string> EnvironmentVariables { get; set; }
}
}