Create DbDriver and DI the driver + the python interface
This commit is contained in:
+15
-13
@@ -1,11 +1,24 @@
|
||||
using WebServer.Components;
|
||||
using PythonInterop;
|
||||
using DataBase;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Load the module in globally and use correct path for local or docker runners
|
||||
#if DEBUG
|
||||
AIModule interopModule = new AIModule(PythonPathBase: "/usr/", PythonVersion: "python3.11");
|
||||
#else
|
||||
AIModule interopModule = new AIModule();
|
||||
#endif
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddRazorComponents()
|
||||
.AddInteractiveServerComponents();
|
||||
builder.Services.AddRazorComponents().AddInteractiveServerComponents();
|
||||
|
||||
// Insert the DB driver for Dependency Injection
|
||||
builder.Services.AddSingleton<DbDriver>();
|
||||
|
||||
// Insert the python modlue for Dependency Injection
|
||||
builder.Services.AddSingleton(interopModule);
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
@@ -16,17 +29,6 @@ if (!app.Environment.IsDevelopment()) {
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
// Load the module in globally and use correct path for local or docker runners
|
||||
#if DEBUG
|
||||
AIModule interopModule = new AIModule(PythonPathBase: "/usr/", PythonVersion: "python3.11");
|
||||
#else
|
||||
AIModule interopModule = new AIModule();
|
||||
#endif
|
||||
|
||||
// Run this for testing purposes
|
||||
interopModule.TestAI();
|
||||
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseAntiforgery();
|
||||
|
||||
Reference in New Issue
Block a user