// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IYamlIndexer yamlIndexer) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); // get the path to the content directory so the yaml headers can be indexed as metadata var contentPath = string.Format("{0}\\posts\\", env.WebRootPath); yamlIndexer.IndexContentFiles(contentPath); }
public FeedController(IMarkdownContentLoader markdownLoader, IYamlIndexer indexer, IOptions <DownrOptions> options) { _markdownLoader = markdownLoader; _indexer = indexer; _options = options.Value; }
public ContentRefreshWorker(ILogger <ContentRefreshWorker> logger, IYamlIndexer yamlIndexer, IOptions <DownrOptions> config) { this.config = config.Value; this.yamlIndexer = yamlIndexer; this.logger = logger; }
public static void UseWebServerFileSystemStorage( this DownrContentProviderConfigurator configurator) { IYamlIndexer yamlIndexer = (IYamlIndexer) configurator.Builder.ApplicationServices.GetService(typeof(IYamlIndexer)); yamlIndexer.IndexContentFiles(); }
public PostsController( IYamlIndexer indexer, IOptions <DownrOptions> options ) : base(indexer) { _options = options.Value; }
public static void UseAzureStorage( this DownrContentProviderConfigurator configurator) { IYamlIndexer yamlIndexer = (IYamlIndexer) configurator.Builder.ApplicationServices.GetService(typeof(IYamlIndexer)); IOptions <AzureStorageConfiguration> config = (IOptions <AzureStorageConfiguration>) configurator.Builder.ApplicationServices.GetService(typeof(IOptions <AzureStorageConfiguration>)); yamlIndexer.IndexContentFiles(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IYamlIndexer yamlIndexer) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseResponseCompression(); app.UseStaticFiles(new StaticFileOptions { OnPrepareResponse = _ => _.Context.Response.Headers[HeaderNames.CacheControl] = "public,max-age=604800" }); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); // get the path to the content directory so the yaml headers can be indexed as metadata if (string.IsNullOrWhiteSpace(env.WebRootPath)) { env.WebRootPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot"); } var contentPath = Path.Combine(env.WebRootPath, "posts"); yamlIndexer.IndexContentFiles(contentPath); }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IOptions <DownrOptions> downrOptions, IYamlIndexer yamlIndexer) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseWebAssemblyDebugging(); } else { app.UseExceptionHandler("/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseBlazorFrameworkFiles(); app.UseStaticFiles(); app.UseResponseCompression(); app.UseStaticFiles(new StaticFileOptions { OnPrepareResponse = _ => _.Context.Response.Headers[HeaderNames.CacheControl] = "public,max-age=604800" }); app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapRazorPages(); endpoints.MapControllers(); endpoints.MapFallbackToFile("index.html"); endpoints.MapControllerRoute( name: "blog-feed-rss", pattern: "/feed/rss", defaults: new { controller = "Feed", Action = "Rss" } ); }); app.UseDownr() //.UseAzureStorage(); // use azure blob storage .UseWebServerFileSystemStorage(); // use local web server storage }
public PostService(IYamlIndexer indexer, IOptions <DownrOptions> downrOptions) { _downrOptions = downrOptions.Value; _indexer = indexer; }
public CategoryController(IYamlIndexer indexer) : base(indexer) { }
public TagCloudViewComponent(IYamlIndexer indexer) { _indexer = indexer; }
public HomeController(IYamlIndexer indexer) { _indexer = indexer; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IYamlIndexer yamlIndexer, IOptions <DownrOptions> downrOptions) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseResponseCompression(); app.UseStaticFiles(new StaticFileOptions { OnPrepareResponse = _ => _.Context.Response.Headers[HeaderNames.CacheControl] = "public,max-age=604800" }); var stem = downrOptions.Value.Stem.StripLeading("/"); if (!string.IsNullOrEmpty(stem) && !stem.EndsWith("/")) { stem += "/"; } app.UseMvc(routes => { routes.MapRoute( name: "blog-root", template: stem, defaults: new { controller = "Posts", Action = "Index" } ); routes.MapRoute( name: "blog-post", template: stem + "posts/{slug}", defaults: new { controller = "Posts", Action = "Post" } ); routes.MapRoute( name: "blog-categories", template: stem + "category/{name}", defaults: new { controller = "Category", Action = "Index" } ); routes.MapRoute( name: "blog-feed-rss", template: stem + "feed/rss", defaults: new { controller = "Feed", Action = "Rss" } ); }); var logger = loggerFactory.CreateLogger <Startup>(); logger.LogInformation("Options.Title: '{0}'", downrOptions.Value.Title); logger.LogInformation("Options.RooUrl: '{0}'", downrOptions.Value.RootUrl); logger.LogInformation("Options.Stem: '{0}' ({1})", downrOptions.Value.Stem, stem); // get the path to the content directory so the yaml headers can be indexed as metadata if (string.IsNullOrWhiteSpace(env.WebRootPath)) { env.WebRootPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot"); logger.LogInformation("Set WebRootPath to '{0}'", env.WebRootPath); } var contentPath = Path.Combine(env.WebRootPath, "posts"); yamlIndexer.IndexContentFiles(contentPath); }
public PostsController(IYamlIndexer indexer) : base(indexer) { }
public BaseController(IYamlIndexer indexer) { _indexer = indexer; }
public PostService(IYamlIndexer indexer) { _indexer = indexer; }
public PostsController(PostService postService, IOptions <DownrOptions> options, IYamlIndexer yamlIndexer) { _yamlIndexer = yamlIndexer; _postService = postService; _options = options.Value; }
public FeedController(IMarkdownContentLoader markdownLoader, IYamlIndexer indexer) { _markdownLoader = markdownLoader; _indexer = indexer; }