mirror of
https://github.com/RedWizardsLab/EchoHub.git
synced 2026-09-04 08:36:11 +02:00
fix: Update connection string handling to allow for empty configuration
This commit is contained in:
@@ -39,8 +39,10 @@ while (true)
|
|||||||
|
|
||||||
// ── SQLite + EF Core ─────────────────────────────────────────────────
|
// ── SQLite + EF Core ─────────────────────────────────────────────────
|
||||||
var defaultDbPath = Path.Combine(AppContext.BaseDirectory, "echohub.db");
|
var defaultDbPath = Path.Combine(AppContext.BaseDirectory, "echohub.db");
|
||||||
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection")
|
var configured = builder.Configuration.GetConnectionString("DefaultConnection");
|
||||||
?? $"Data Source={defaultDbPath}";
|
var connectionString = string.IsNullOrWhiteSpace(configured)
|
||||||
|
? $"Data Source={defaultDbPath}"
|
||||||
|
: configured;
|
||||||
|
|
||||||
builder.Services.AddDbContext<EchoHubDbContext>(options =>
|
builder.Services.AddDbContext<EchoHubDbContext>(options =>
|
||||||
options.UseSqlite(connectionString));
|
options.UseSqlite(connectionString));
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"Urls": "http://0.0.0.0:5000",
|
"Urls": "http://0.0.0.0:5000",
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"DefaultConnection": "Data Source=echohub.db"
|
"DefaultConnection": ""
|
||||||
},
|
},
|
||||||
"Jwt": {
|
"Jwt": {
|
||||||
"Secret": "CHANGE_ME_minimum_32_characters_long_secret_key",
|
"Secret": "CHANGE_ME_minimum_32_characters_long_secret_key",
|
||||||
|
|||||||
Reference in New Issue
Block a user