refatco and cleanup
This commit is contained in:
parent
94eb8e2fff
commit
4d51267dfd
66 changed files with 32 additions and 1619 deletions
|
|
@ -54,7 +54,6 @@ namespace isnd
|
|||
var smtpSettingsconf = Configuration.GetSection("Smtp");
|
||||
var isndSettingsconf = Configuration.GetSection("Isn");
|
||||
var adminStartupListConf = Configuration.GetSection("AdminList");
|
||||
var unleashConf = Configuration.GetSection("Unleash");
|
||||
|
||||
services.Configure<ForwardedHeadersOptions>(options =>
|
||||
{
|
||||
|
|
@ -65,7 +64,6 @@ namespace isnd
|
|||
services.Configure<SmtpSettings>(smtpSettingsconf)
|
||||
.Configure<IsndSettings>(isndSettingsconf)
|
||||
.Configure<AdminStartupList>(adminStartupListConf)
|
||||
.Configure<UnleashClientSettings>(unleashConf)
|
||||
.Configure<MigrationsEndPointOptions>(o => o.Path = "~/migrate")
|
||||
.AddDbContext<ApplicationDbContext>(options =>
|
||||
options.UseNpgsql(
|
||||
|
|
@ -94,20 +92,7 @@ namespace isnd
|
|||
.AddTransient<IEmailSender, EmailSender>()
|
||||
.AddTransient<IPackageManager, PackageManager>()
|
||||
.AddSingleton<IAuthorizationHandler, ValidApiKeyRequirementHandler>()
|
||||
.AddSingleton(s =>
|
||||
{
|
||||
var config = s.GetRequiredService<IOptions<UnleashClientSettings>>();
|
||||
if (config.Value == null)
|
||||
throw new System.Exception("No unleash client settings");
|
||||
if (config.Value.ApiUrl == null)
|
||||
throw new System.Exception("No unleash client ApiUrl");
|
||||
if (config.Value.ClientApiKey == null)
|
||||
throw new System.Exception("No unleash client ClientApiKey");
|
||||
return s.GetRequiredService<Microsoft.AspNetCore.Hosting.IWebHostEnvironment>().CreateUnleashClient(config.Value);
|
||||
});
|
||||
|
||||
|
||||
services.AddAuthentication("Bearer")
|
||||
.AddAuthentication("Bearer")
|
||||
.AddJwtBearer("Bearer", options =>
|
||||
{
|
||||
options.Authority = isndSettingsconf.GetValue<string>("ExternalUrl");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue