Skip to content
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.

Commit

Permalink
Use the wwwroot from the right folder (from the output)
Browse files Browse the repository at this point in the history
  • Loading branch information
imclint21 committed May 24, 2019
1 parent 128f736 commit bc0580a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Stratis.Bitcoin.Features.Api/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.IO;
using System.Reflection;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
Expand All @@ -7,14 +8,17 @@
using Microsoft.Extensions.PlatformAbstractions;
using Microsoft.Extensions.FileProviders;
using Swashbuckle.AspNetCore.Swagger;
using System.Reflection;

namespace Stratis.Bitcoin.Features.Api
{
public class Startup
{
private readonly string currentFolder;

public Startup(IHostingEnvironment env)
{
this.currentFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

IConfigurationBuilder builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
Expand Down Expand Up @@ -111,7 +115,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF

app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(@"C:\Users\me\Source\Repos\StratisBitcoinFullNode2\src\Stratis.Bitcoin.Features.Api\wwwroot\"),
FileProvider = new PhysicalFileProvider(Path.Combine(this.currentFolder, "wwwroot")),
RequestPath = string.Empty
});

Expand All @@ -126,7 +130,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
options.DocumentTitle = "Stratis.Bitcoin.Api V1";
options.DefaultModelRendering(ModelRendering.Model);
options.InjectStylesheet("/css/swagger.css");
options.IndexStream = () => File.OpenRead(@"C:\Users\me\source\repos\StratisBitcoinFullNode2\src\Stratis.Bitcoin.Features.Api\wwwroot\swagger.default.html");
options.IndexStream = () => File.OpenRead(Path.Combine(this.currentFolder, "wwwroot", "swagger.default.html"));
//c.DocExpansion(DocExpansion.List);
//c.EnableDeepLinking();
//c.EnableFilter();
Expand Down

0 comments on commit bc0580a

Please sign in to comment.