-
Notifications
You must be signed in to change notification settings - Fork 79
Removes default config. Closes #1355 #1464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.jsonanddevproxy-errors.jsonconfiguration 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
DevProxyCommandto 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
--discovermode without a config file),ProxyConfiguration.GetConfigFilePath(configurationRoot)on line 80 will throw anInvalidOperationExceptionbecause there's noFileConfigurationProvider. 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 orProxyUtils.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.
garrytrinder
left a comment
There was a problem hiding this 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.
Removes default config. Closes #1355