dont add development dbcontext to services if in production

This commit is contained in:
Alan Moon 2025-03-19 12:20:30 -07:00
parent 51ead169e8
commit 423eb7bc31

View File

@ -20,7 +20,10 @@ builder.Services.AddControllers(options => {
options.OutputFormatters.RemoveType<HttpNoContentOutputFormatter>(); options.OutputFormatters.RemoveType<HttpNoContentOutputFormatter>();
options.Filters.Add<LogRequestOnError>(); options.Filters.Add<LogRequestOnError>();
}); });
if (builder.Environment.IsDevelopment())
builder.Services.AddDbContext<DBContext>(); builder.Services.AddDbContext<DBContext>();
else
builder.Services.AddDbContext<ProductionDBContext>(); builder.Services.AddDbContext<ProductionDBContext>();
// create Modding Service singleton here ... do this before start http server to avoid serve invalid assets list // create Modding Service singleton here ... do this before start http server to avoid serve invalid assets list