Fix issues with connection strings

This commit is contained in:
Reimar 2024-08-13 19:08:30 +02:00
parent 41c13b777e
commit 39521bf284
Signed by: Reimar
GPG Key ID: 93549FA07F0AE268
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.