Initial Backend
This commit is contained in:
parent
bcf92c21e6
commit
3f6ff87370
15 changed files with 782 additions and 0 deletions
36
backend/Program.cs
Normal file
36
backend/Program.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using ContainerDashboard.Services;
|
||||
using ContainerDashboard.Repositories;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
||||
builder.Services.AddOpenApi();
|
||||
builder.Services.AddTransient<IContainerService, ContainerService>();
|
||||
builder.Services.AddControllers();
|
||||
|
||||
var backend = Environment.GetEnvironmentVariable("BACKEND");
|
||||
|
||||
switch (backend)
|
||||
{
|
||||
case "kubernetes":
|
||||
builder.Services.AddTransient<IContainerHandler, KubernetesHandler>();
|
||||
break;
|
||||
case "docker":
|
||||
throw new NotImplementedException();
|
||||
default:
|
||||
throw new Exception("Incorrect backend variable");
|
||||
}
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.MapOpenApi();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
Loading…
Add table
Add a link
Reference in a new issue