using JellyGlass.Repositories; using JellyGlass.Services; using Microsoft.EntityFrameworkCore; 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.AddControllers(); builder.Configuration.GetSection("TestingLogin"); string dbConnectionString; if (builder.Environment.IsDevelopment()) { dbConnectionString = "Data Source=JellyGlass-test.db;"; } else { dbConnectionString = "Data Source=JellyGlass.db;"; } builder.Services.AddSqlite(dbConnectionString); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddScoped(); builder.Services.AddTransient(); builder.Services.AddTransient(); var app = builder.Build(); using (var scope = app.Services.CreateScope()) { var dbContext = scope.ServiceProvider.GetRequiredService(); dbContext.Database.Migrate(); dbContext.Servers.Add(new JellyGlass.Models.Server() { ApiToken = "56b6f91b816540b59d03a0db53c2dc8e", Id = "1", Owner = "Riley", Url = "https://jellyfin.foxhawk.co.uk" }); dbContext.SaveChanges(); } // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.MapOpenApi(); } app.UseHttpsRedirection(); app.MapControllers(); app.UseDefaultFiles(); app.UseStaticFiles(); app.Run();