@@ -17,6 +17,7 @@ sealed class DevProxyCommand : RootCommand
1717 private WebApplication ? _app ;
1818
1919 internal const string PortOptionName = "--port" ;
20+ internal const string ApiPortOptionName = "--api-port" ;
2021 internal const string IpAddressOptionName = "--ip-address" ;
2122 internal const string LogLevelOptionName = "--log-level" ;
2223 internal const string RecordOptionName = "--record" ;
@@ -196,6 +197,12 @@ private void ConfigureCommand()
196197 HelpName = "port"
197198 } ;
198199
200+ var apiPortOption = new Option < int ? > ( ApiPortOptionName )
201+ {
202+ Description = "The port for the Dev Proxy API to listen on" ,
203+ HelpName = "api-port"
204+ } ;
205+
199206 var recordOption = new Option < bool ? > ( RecordOptionName )
200207 {
201208 Description = "Use this option to record all request logs"
@@ -307,6 +314,7 @@ private void ConfigureCommand()
307314
308315 var options = new List < Option >
309316 {
317+ apiPortOption ,
310318 asSystemProxyOption ,
311319 configFileOption ,
312320 discoverOption ,
@@ -350,6 +358,11 @@ private void ConfigureFromOptions(ParseResult parseResult)
350358 {
351359 _proxyConfiguration . Port = port . Value ;
352360 }
361+ var apiPort = parseResult . GetValueOrDefault < int ? > ( ApiPortOptionName ) ;
362+ if ( apiPort is not null )
363+ {
364+ _proxyConfiguration . ApiPort = apiPort . Value ;
365+ }
353366 var ipAddress = parseResult . GetValueOrDefault < string ? > ( IpAddressOptionName ) ;
354367 if ( ipAddress is not null )
355368 {
0 commit comments