Skip to content

Conversation

@niteshsinghal85
Copy link

Fixes #1472

Added support for configuring the Dev Proxy API port via the --api-port command-line option.
This allows users to dynamically set the API port at runtime instead of only through configuration files.

The change makes IProxyConfiguration.ApiPort settable and integrates the new option into the command-line parsing logic with a default value of 8897.

@niteshsinghal85 niteshsinghal85 marked this pull request as ready for review December 26, 2025 12:35
@niteshsinghal85 niteshsinghal85 requested a review from a team as a code owner December 26, 2025 12:35
@waldekmastykarz
Copy link
Collaborator

Cool! We'll review in the next couple of days. Thanks!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for configuring the Dev Proxy API port via the --api-port command-line option, allowing users to dynamically set the API port at runtime instead of only through configuration files.

Key changes:

  • Made IProxyConfiguration.ApiPort settable to support runtime configuration
  • Added --api-port command-line option with a default value of 8897
  • Integrated the new option into command-line parsing and application startup logic

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
DevProxy.Abstractions/Proxy/IProxyConfiguration.cs Changed ApiPort property from read-only to settable to support runtime configuration
DevProxy/Commands/DevProxyCommand.cs Added --api-port option definition with description and help text, and configuration logic to apply the parsed value
DevProxy/Commands/DevProxyConfigOptions.cs Added ApiPort property and option registration for initial parsing
DevProxy/Program.cs Updated Kestrel configuration to use the command-line option with fallback to configuration file

Comment on lines +117 to +118
var apiPortOption = new Option<int?>(DevProxyCommand.ApiPortOptionName);

Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The apiPortOption is missing a description and help name, unlike other options in this constructor. For consistency with other options like ipAddressOption and logLevelOption, consider adding Description and HelpName properties.

Suggested change
var apiPortOption = new Option<int?>(DevProxyCommand.ApiPortOptionName);
var apiPortOption = new Option<int?>(DevProxyCommand.ApiPortOptionName)
{
Description = "Port on which Dev Proxy exposes its API.",
HelpName = "PORT"
};

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose the apiPort setting as a command line option

2 participants