Fix issues with connection strings

This commit is contained in:
Reimar 2024-08-13 19:08:30 +02:00
parent 9879ececa4
commit 8d20f7d651
2 changed files with 6 additions and 2 deletions

4
API/.gitignore vendored
View File

@ -1 +1,3 @@
database.sqlite3* database.sqlite3*
efbundle

View File

@ -37,9 +37,11 @@ namespace API
IConfiguration Configuration = builder.Configuration; IConfiguration Configuration = builder.Configuration;
var connectionString = Configuration.GetConnectionString("DefaultConnection") ?? Environment.GetEnvironmentVariable("DefaultConnection"); var connectionString = Configuration.GetConnectionString("DefaultConnection") ?? Environment.GetEnvironmentVariable("DEFAULT_CONNECTION");
builder.Services.AddDbContext<AppDBContext>(options => options.UseSqlite(connectionString)); builder.Services.AddDbContext<AppDBContext>(options => options.UseSqlite(connectionString));
Console.WriteLine("Connecting to database with connection string: " + connectionString);
var app = builder.Build(); var app = builder.Build();
// Configure the HTTP request pipeline. // Configure the HTTP request pipeline.