bettah config

This commit is contained in:
tparnell
2019-02-02 14:17:20 -05:00
parent f3080faae0
commit d873be97d8
3 changed files with 21 additions and 14 deletions

17
.vscode/launch.json vendored
View File

@@ -1,18 +1,17 @@
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/TerribleDev.Blog.Web/bin/Debug/netcoreapp2.2/TerribleDev.Blog.Web.dll",
"program": "${workspaceFolder}/src/TerribleDev.Blog.Web/bin/Debug/netcoreapp2.2/TerribleDev.Blog.Web.dll",
"args": [],
"cwd": "${workspaceFolder}/TerribleDev.Blog.Web",
"cwd": "${workspaceFolder}/src/TerribleDev.Blog.Web",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart",
"launchBrowser": {
@@ -42,5 +41,5 @@
"request": "attach",
"processId": "${command:pickProcess}"
}
,]
]
}

2
.vscode/tasks.json vendored
View File

@@ -7,7 +7,7 @@
"type": "process",
"args": [
"build",
"${workspaceFolder}/TerribleDev.Blog.Web/TerribleDev.Blog.Web.csproj"
"${workspaceFolder}/src/TerribleDev.Blog.Web/TerribleDev.Blog.Web.csproj"
],
"problemMatcher": "$msCompile"
}

View File

@@ -21,19 +21,27 @@ namespace TerribleDev.Blog.Web
{
public class Startup
{
public Startup(IConfiguration configuration)
public Startup(IConfiguration configuration, IHostingEnvironment env)
{
Configuration = configuration;
Env = env;
}
public IConfiguration Configuration { get; }
public IHostingEnvironment Env { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
var blogConfig = new BlogConfiguration();
Configuration.GetSection("Blog").Bind(blogConfig);
services.AddSingleton(blogConfig);
Func<BlogConfiguration> getBlog = () => Configuration.GetSection("Blog").Get<BlogConfiguration>();
if(Env.IsDevelopment())
{
services.AddTransient(a => getBlog());
}
else
{
services.AddSingleton(getBlog());
}
services.AddResponseCompression(a =>
{
a.EnableForHttps = true;