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,8 +20,11 @@ builder.Services.AddControllers(options => {
options.OutputFormatters.RemoveType<HttpNoContentOutputFormatter>(); options.OutputFormatters.RemoveType<HttpNoContentOutputFormatter>();
options.Filters.Add<LogRequestOnError>(); options.Filters.Add<LogRequestOnError>();
}); });
builder.Services.AddDbContext<DBContext>();
builder.Services.AddDbContext<ProductionDBContext>(); if (builder.Environment.IsDevelopment())
builder.Services.AddDbContext<DBContext>();
else
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
builder.Services.AddSingleton<ModdingService>(new ModdingService()); builder.Services.AddSingleton<ModdingService>(new ModdingService());