fix: Update connection string handling to allow for empty configuration

This commit is contained in:
HueByte
2026-02-19 04:53:43 +01:00
parent d4d5a71ec4
commit 70ca2da7ae
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -39,8 +39,10 @@ while (true)
// ── SQLite + EF Core ─────────────────────────────────────────────────
var defaultDbPath = Path.Combine(AppContext.BaseDirectory, "echohub.db");
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection")
?? $"Data Source={defaultDbPath}";
var configured = builder.Configuration.GetConnectionString("DefaultConnection");
var connectionString = string.IsNullOrWhiteSpace(configured)
? $"Data Source={defaultDbPath}"
: configured;
builder.Services.AddDbContext<EchoHubDbContext>(options =>
options.UseSqlite(connectionString));