From add65e16827ac353aa48d30b0f41e6cb463f6ccf Mon Sep 17 00:00:00 2001 From: Niko Date: Fri, 18 Nov 2022 18:30:45 +0100 Subject: [PATCH] Fixed #951 --- App.config | 3 +++ AppSettings.cs | 8 ++++++++ Program.cs | 40 +++++++++++++++++++++++++++++++--------- 3 files changed, 42 insertions(+), 9 deletions(-) diff --git a/App.config b/App.config index d4e493a83..9bd9bad44 100644 --- a/App.config +++ b/App.config @@ -17,5 +17,8 @@ + + + diff --git a/AppSettings.cs b/AppSettings.cs index d8968531e..cbd050e83 100644 --- a/AppSettings.cs +++ b/AppSettings.cs @@ -41,5 +41,13 @@ public static class AppSettings public static bool SuppressProjects { get; set; } = string.Equals(ConfigurationManager.AppSettings["SuppressProjects"], "true", StringComparison.OrdinalIgnoreCase); + public static bool SuppressSpeakerBlogs { get; set; } + = string.Equals(ConfigurationManager.AppSettings["SuppressSpeakerBlogs"], "true", StringComparison.OrdinalIgnoreCase); + + public static bool SuppressSpeakerGeoLocation { get; set; } + = string.Equals(ConfigurationManager.AppSettings["SuppressSpeakerGeoLocation"], "true", StringComparison.OrdinalIgnoreCase); + + public static bool SuppressSpeakerImages { get; set; } + = string.Equals(ConfigurationManager.AppSettings["SuppressSpeakerImages"], "true", StringComparison.OrdinalIgnoreCase); } } diff --git a/Program.cs b/Program.cs index 117fe7c5a..ce35d1edb 100644 --- a/Program.cs +++ b/Program.cs @@ -53,17 +53,39 @@ public static async Task Main(string[] args) private static Bootstrapper AddSpeakersPipeline(Bootstrapper bootstrapper) { + var sources = new ExecuteSources("community/speakers/*.md"); + + if (!AppSettings.SuppressSpeakerGeoLocation) + { + sources.Add(new GeocodeLocations(Config.FromSetting(SiteKeys.AzureMapsSubscriptionKey))); + } + else + { + Console.WriteLine("Suppressing Geolocation extraction ****SHOULD ONLY BE IN DEBUG***"); + } + + if (!AppSettings.SuppressSpeakerBlogs) + { + sources.Add(new GetBlogFeeds()); + } + else + { + Console.WriteLine("Suppressing Speaker Blog Entry retrieval ****SHOULD ONLY BE IN DEBUG***"); + } + + if (!AppSettings.SuppressSpeakerImages) + { + sources.Add(new SpeakerImage()); + } + else + { + Console.WriteLine("Suppressing Speaker Images retrieval ****SHOULD ONLY BE IN DEBUG***"); + } + bootstrapper = bootstrapper.ModifyPipeline( nameof(Statiq.Web.Pipelines.Content), - x => x.ProcessModules.Add( - // Modules for speakers - new ExecuteSources("community/speakers/*.md") - { - new GeocodeLocations(Config.FromSetting(SiteKeys.AzureMapsSubscriptionKey)), - new GetBlogFeeds(), - new SpeakerImage() - } - )); + x => x.ProcessModules.Add(sources)); + return bootstrapper; }