From a0e9a51c3c51882449fc3464739aea25b9ad5b21 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Feb 2026 12:02:59 +0000 Subject: [PATCH 1/2] Initial plan From d12fea40da07b59fe79a6c157faef510d0a1beea Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Feb 2026 12:17:40 +0000 Subject: [PATCH 2/2] Add --no-watch flag to disable config file auto-restart Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com> --- DevProxy.Abstractions/Proxy/IProxyConfiguration.cs | 1 + DevProxy/Commands/DevProxyCommand.cs | 12 ++++++++++++ DevProxy/Proxy/ConfigFileWatcher.cs | 6 ++++++ DevProxy/Proxy/ProxyConfiguration.cs | 1 + 4 files changed, 20 insertions(+) diff --git a/DevProxy.Abstractions/Proxy/IProxyConfiguration.cs b/DevProxy.Abstractions/Proxy/IProxyConfiguration.cs index 59f1d6d0..67693c60 100644 --- a/DevProxy.Abstractions/Proxy/IProxyConfiguration.cs +++ b/DevProxy.Abstractions/Proxy/IProxyConfiguration.cs @@ -41,6 +41,7 @@ public interface IProxyConfiguration LogLevel LogLevel { get; } ReleaseType NewVersionNotification { get; } bool NoFirstRun { get; set; } + bool NoWatch { get; set; } int Port { get; set; } bool Record { get; set; } bool ShowTimestamps { get; } diff --git a/DevProxy/Commands/DevProxyCommand.cs b/DevProxy/Commands/DevProxyCommand.cs index c5c4b8b3..1a217db4 100644 --- a/DevProxy/Commands/DevProxyCommand.cs +++ b/DevProxy/Commands/DevProxyCommand.cs @@ -31,6 +31,7 @@ sealed class DevProxyCommand : RootCommand Description = "The path to the configuration file" }; internal const string NoFirstRunOptionName = "--no-first-run"; + internal const string NoWatchOptionName = "--no-watch"; internal const string AsSystemProxyOptionName = "--as-system-proxy"; internal const string InstallCertOptionName = "--install-cert"; internal const string UrlsToWatchOptionName = "--urls-to-watch"; @@ -312,6 +313,11 @@ private void ConfigureCommand() Description = "Skip the first run experience" }; + var noWatchOption = new Option(NoWatchOptionName) + { + Description = "Disable automatic restart on configuration file changes" + }; + var discoverOption = new Option(DiscoverOptionName) { Description = "Run Dev Proxy in discovery mode" @@ -427,6 +433,7 @@ private void ConfigureCommand() logForOption, logLevelOption, noFirstRunOption, + noWatchOption, portOption, recordOption, timeoutOption, @@ -493,6 +500,11 @@ private void ConfigureFromOptions(ParseResult parseResult) { _proxyConfiguration.NoFirstRun = noFirstRun.Value; } + var noWatch = parseResult.GetValueOrDefault(NoWatchOptionName); + if (noWatch is not null) + { + _proxyConfiguration.NoWatch = noWatch.Value; + } var asSystemProxy = parseResult.GetValueOrDefault(AsSystemProxyOptionName); if (asSystemProxy is not null) { diff --git a/DevProxy/Proxy/ConfigFileWatcher.cs b/DevProxy/Proxy/ConfigFileWatcher.cs index b3d71003..261ff4d4 100644 --- a/DevProxy/Proxy/ConfigFileWatcher.cs +++ b/DevProxy/Proxy/ConfigFileWatcher.cs @@ -44,6 +44,12 @@ public static void Reset() public Task StartAsync(CancellationToken cancellationToken) { + if (_proxyConfiguration.NoWatch) + { + _logger.LogDebug("Configuration file watching is disabled"); + return Task.CompletedTask; + } + var configFilePath = _proxyConfiguration.ConfigFile; if (string.IsNullOrEmpty(configFilePath) || !File.Exists(configFilePath)) { diff --git a/DevProxy/Proxy/ProxyConfiguration.cs b/DevProxy/Proxy/ProxyConfiguration.cs index 381fcc83..02e2ae32 100755 --- a/DevProxy/Proxy/ProxyConfiguration.cs +++ b/DevProxy/Proxy/ProxyConfiguration.cs @@ -38,6 +38,7 @@ public string ConfigFile [JsonConverter(typeof(JsonStringEnumConverter))] public LogLevel LogLevel { get; set; } = LogLevel.Information; public bool NoFirstRun { get; set; } + public bool NoWatch { get; set; } [JsonConverter(typeof(JsonStringEnumConverter))] public ReleaseType NewVersionNotification { get; set; } = ReleaseType.Stable; public int Port { get; set; } = 8000;