From b1bfb76ffcc9ce10830bcca3f3ea7e9ba74cfc41 Mon Sep 17 00:00:00 2001 From: niteshsinghal85 Date: Fri, 26 Dec 2025 17:56:52 +0530 Subject: [PATCH] expose apiPort via commndline --- DevProxy.Abstractions/Proxy/IProxyConfiguration.cs | 2 +- DevProxy/Commands/DevProxyCommand.cs | 13 +++++++++++++ DevProxy/Commands/DevProxyConfigOptions.cs | 4 ++++ DevProxy/Program.cs | 4 +++- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/DevProxy.Abstractions/Proxy/IProxyConfiguration.cs b/DevProxy.Abstractions/Proxy/IProxyConfiguration.cs index 98c50ab1..ab6d084f 100644 --- a/DevProxy.Abstractions/Proxy/IProxyConfiguration.cs +++ b/DevProxy.Abstractions/Proxy/IProxyConfiguration.cs @@ -20,7 +20,7 @@ public enum ReleaseType public interface IProxyConfiguration { - int ApiPort { get; } + int ApiPort { get; set; } bool AsSystemProxy { get; set; } string ConfigFile { get; } #pragma warning disable CA2227 diff --git a/DevProxy/Commands/DevProxyCommand.cs b/DevProxy/Commands/DevProxyCommand.cs index b581b54a..f2fb0b6f 100644 --- a/DevProxy/Commands/DevProxyCommand.cs +++ b/DevProxy/Commands/DevProxyCommand.cs @@ -17,6 +17,7 @@ sealed class DevProxyCommand : RootCommand private WebApplication? _app; internal const string PortOptionName = "--port"; + internal const string ApiPortOptionName = "--api-port"; internal const string IpAddressOptionName = "--ip-address"; internal const string LogLevelOptionName = "--log-level"; internal const string RecordOptionName = "--record"; @@ -196,6 +197,12 @@ private void ConfigureCommand() HelpName = "port" }; + var apiPortOption = new Option(ApiPortOptionName) + { + Description = "The port for the Dev Proxy API to listen on", + HelpName = "api-port" + }; + var recordOption = new Option(RecordOptionName) { Description = "Use this option to record all request logs" @@ -307,6 +314,7 @@ private void ConfigureCommand() var options = new List