diff --git a/src/FluffySpoon.AspNet.NGrok/NGrokHostedService.cs b/src/FluffySpoon.AspNet.NGrok/NGrokHostedService.cs index 7bc141d..89994af 100644 --- a/src/FluffySpoon.AspNet.NGrok/NGrokHostedService.cs +++ b/src/FluffySpoon.AspNet.NGrok/NGrokHostedService.cs @@ -54,6 +54,9 @@ internal void InjectServerAddressesFeature(IServerAddressesFeature? feature) private async void RunAsync() { + if (_options.Disable) + return; + await _nGrokDownloader.DownloadExecutableAsync(); var url = await AdjustApplicationHttpUrlIfNeededAsync(); diff --git a/src/FluffySpoon.AspNet.NGrok/NgrokAspNetCoreExtensions.cs b/src/FluffySpoon.AspNet.NGrok/NgrokAspNetCoreExtensions.cs index f4a8e95..4509380 100644 --- a/src/FluffySpoon.AspNet.NGrok/NgrokAspNetCoreExtensions.cs +++ b/src/FluffySpoon.AspNet.NGrok/NgrokAspNetCoreExtensions.cs @@ -48,9 +48,6 @@ public static IWebHostBuilder UseNGrok(this IWebHostBuilder builder) return builder .ConfigureServices((context, services) => { - if (services.All(x => x.ImplementationType != typeof(NGrokHostedService))) - return; - services.AddSingleton(p => p.GetRequiredService()); }); } diff --git a/src/FluffySpoon.AspNet.NGrok/NgrokOptions.cs b/src/FluffySpoon.AspNet.NGrok/NgrokOptions.cs index 639774c..2253049 100644 --- a/src/FluffySpoon.AspNet.NGrok/NgrokOptions.cs +++ b/src/FluffySpoon.AspNet.NGrok/NgrokOptions.cs @@ -6,6 +6,7 @@ namespace FluffySpoon.AspNet.NGrok { public class NGrokOptions { + public bool Disable { get; set; } public bool ShowNGrokWindow { get; set; }