Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
NikoMix committed Nov 18, 2022
1 parent 695a635 commit add65e1
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 9 deletions.
3 changes: 3 additions & 0 deletions App.config
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@
<!-- Turn on to speed up processing for development/writing -->
<add key="SuppressSpeakers" value="false"/>
<add key="SuppressProjects" value="false"/>
<add key="SuppressSpeakerBlogs" value="false"/>
<add key="SuppressSpeakerGeoLocation" value="false"/>
<add key="SuppressSpeakerImages" value="false"/>
</appSettings>
</configuration>
8 changes: 8 additions & 0 deletions AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
40 changes: 31 additions & 9 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,39 @@ public static async Task<int> 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;
}

Expand Down

0 comments on commit add65e1

Please sign in to comment.