Adds code
This commit is contained in:
commit
269bf50c78
33 changed files with 1489 additions and 0 deletions
68
Application/Startup.cs
Normal file
68
Application/Startup.cs
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
using Autofac;
|
||||
|
||||
namespace PlanTempus
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public Startup(IWebHostEnvironment env)
|
||||
{
|
||||
var builder = new ConfigurationBuilder()
|
||||
.SetBasePath(env.ContentRootPath)
|
||||
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||
.AddEnvironmentVariables();
|
||||
|
||||
ConfigurationRoot = builder.Build();
|
||||
}
|
||||
|
||||
public IConfigurationRoot ConfigurationRoot { get; private set; }
|
||||
|
||||
public ILifetimeScope AutofacContainer { get; private set; }
|
||||
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddControllers();
|
||||
services.AddOptions();
|
||||
services.AddRazorPages();
|
||||
//services.AddApplicationInsightsTelemetry(ConfigurationRoot["ApplicationInsights:InstrumentationKey"]);
|
||||
services.AddAntiforgery(x => x.HeaderName = "X-ANTI-FORGERY-TOKEN");
|
||||
|
||||
}
|
||||
public void ConfigureContainer(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterModule(new Core.ModuleRegistry.DbPostgreSqlModule
|
||||
{
|
||||
ConnectionString = ConfigurationRoot.GetConnectionString("ptdb")
|
||||
});
|
||||
|
||||
builder.RegisterModule(new Core.ModuleRegistry.TelemetryModule
|
||||
{
|
||||
TelemetryConfig = ConfigurationRoot.GetSection("ApplicationInsights").Get<Core.ModuleRegistry.TelemetryConfig>()
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
|
||||
if (env.IsDevelopment())
|
||||
app.UseDeveloperExceptionPage();
|
||||
else
|
||||
{
|
||||
app.UseExceptionHandler("/Error");
|
||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
}
|
||||
app.UseHttpsRedirection();
|
||||
app.UseRouting();
|
||||
|
||||
app.UseStaticFiles();
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
//endpoints.MapHub<MotionHub>("/motionhub");
|
||||
endpoints.MapRazorPages();
|
||||
endpoints.MapControllers();
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue