1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-17 07:30:59 -05:00

centralize ConfigurationBuilder

This commit is contained in:
Kyle Spearrin
2017-05-05 21:49:55 -04:00
parent 66c5a9b25d
commit 790ccb77c3
8 changed files with 31 additions and 47 deletions

View File

@ -1,7 +1,6 @@
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Configuration;
@ -16,17 +15,7 @@ namespace Bit.Identity
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("settings.json")
.AddJsonFile($"settings.{env.EnvironmentName}.json", optional: true);
if(env.IsDevelopment())
{
builder.AddUserSecrets<Startup>();
}
builder.AddEnvironmentVariables();
.AddSettingsConfiguration<Startup>(env);
Configuration = builder.Build();
Environment = env;
}
@ -74,18 +63,8 @@ namespace Bit.Identity
.AddConsole()
.AddDebug();
if(env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
// Add IdentityServer to the request pipeline.
app.UseIdentityServer();
app.Run(async (context) =>
{
await context.Response.WriteAsync("Hello World!");
});
}
}
}