Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions DevProxy/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
using DevProxy.Commands;
using System.Net;

static WebApplication BuildApplication(string[] args, DevProxyConfigOptions options)
static WebApplication BuildApplication(DevProxyConfigOptions options)
{
var builder = WebApplication.CreateBuilder(args);
// Don't pass command-line args to WebApplication.CreateBuilder because:
// 1. Dev Proxy uses System.CommandLine for CLI parsing, not ASP.NET Core's CommandLineConfigurationProvider
// 2. ConfigureDevProxyConfig clears all configuration sources anyway and only uses JSON config files
var builder = WebApplication.CreateBuilder();

_ = builder.Configuration.ConfigureDevProxyConfig(options);
_ = builder.Logging.ConfigureDevProxyLogging(builder.Configuration, options);
Expand Down Expand Up @@ -36,7 +39,7 @@ static WebApplication BuildApplication(string[] args, DevProxyConfigOptions opti

var options = new DevProxyConfigOptions();
options.ParseOptions(args);
var app = BuildApplication(args, options);
var app = BuildApplication(options);

var devProxyCommand = app.Services.GetRequiredService<DevProxyCommand>();
var loggerFactory = app.Services.GetRequiredService<ILoggerFactory>();
Expand Down