refactorisation de la configuration

This commit is contained in:
Paul Schneider 2021-05-02 15:22:46 +01:00
commit 749eb645d5
7 changed files with 43 additions and 35 deletions

View file

@ -29,8 +29,6 @@ namespace nuget_host
}
public IConfiguration Configuration { get; }
public static string ExternalUrl { get; private set; }
public static string SourceDir { get; private set; }
public static string RootApiKeySecret { get; private set; }
// This method gets called by the runtime. Use this method to add services to the container.
@ -55,6 +53,8 @@ namespace nuget_host
var smtpSettingsconf = Configuration.GetSection("SmtpSettings");
services.Configure<SmtpSettings>(smtpSettingsconf);
var nugetSettingsconf = Configuration.GetSection("NugetSettings");
services.Configure<NugetSettings>(nugetSettingsconf);
}
@ -71,9 +71,6 @@ namespace nuget_host
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}
ExternalUrl = Configuration["NuGet:ExternalUrl"];
SourceDir = Configuration["NuGet:SourceDir"];
RootApiKeySecret = Configuration["RootApiKeySecret"];
app.UseStaticFiles();