Skip to content

Conversation

@waldekmastykarz
Copy link
Collaborator

Removes default config. Closes #1355

Copilot AI review requested due to automatic review settings November 29, 2025 14:49
@waldekmastykarz waldekmastykarz requested a review from a team as a code owner November 29, 2025 14:49
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 removes the default configuration files (devproxyrc.json and devproxy-errors.json) from the DevProxy folder and adjusts error handling logic to allow Dev Proxy to run without a configuration file present. Instead of throwing exceptions early when no config file is found, the validation is moved to the command invocation stage where more informative error messages can be displayed.

Key changes:

  • Removed default devproxyrc.json and devproxy-errors.json configuration files
  • Modified plugin loading to return early instead of throwing when no plugins are configured
  • Changed configuration manager to return empty configuration instead of throwing when no config file exists
  • Added runtime validation in DevProxyCommand to check for configuration file presence and display appropriate error messages

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
DevProxy/devproxyrc.json Removed default configuration file with sample plugins and URLs
DevProxy/devproxy-errors.json Removed default error definitions file
DevProxy/Plugins/PluginServiceExtensions.cs Changed to return early with empty plugin set instead of throwing exception when no plugins are configured
DevProxy/Extensions/ConfigurationManagerExtensions.cs Modified to return configuration even when no config file is found, rather than throwing exception
DevProxy/Commands/DevProxyCommand.cs Added configuration file validation check at command invocation time with user-friendly error message
Comments suppressed due to low confidence (1)

DevProxy/Plugins/PluginServiceExtensions.cs:89

  • When plugins are configured but no configuration file exists (e.g., in --discover mode without a config file), ProxyConfiguration.GetConfigFilePath(configurationRoot) on line 80 will throw an InvalidOperationException because there's no FileConfigurationProvider. This breaks the intended behavior of allowing Dev Proxy to run without a config file. Consider checking if a config file exists first, and if not, use an appropriate fallback directory (e.g., current directory or ProxyUtils.AppFolder) for resolving plugin paths.
        if (configuration is IConfigurationRoot configurationRoot)
        {
            configFileDirectory = Path.GetDirectoryName(ProxyConfiguration.GetConfigFilePath(configurationRoot));
            if (string.IsNullOrEmpty(configFileDirectory))
            {
                throw new InvalidOperationException("Unable to resolve config file directory.");
            }
        }
        else
        {
            throw new InvalidOperationException("Unable to resolve config file directory.");
        }

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Copy link
Contributor

@garrytrinder garrytrinder left a comment

Choose a reason for hiding this comment

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

Approved, we will need to update Configure Dev Proxy page to reflect this change.

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.

Remove default config in favor of project-/scenario-specific configs; refactor config checks to root command

2 participants