Skip to content

Commit

Permalink
Fix: 修正 db 檔案在 linux 下會建錯位置的現象
Browse files Browse the repository at this point in the history
  • Loading branch information
teamolhuang committed Feb 11, 2025
1 parent 6e37a81 commit 1039eb4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ public static async Task Main(string[] args)

// 在子目錄 db 底下建立 db file
Directory.CreateDirectory("db");
string dbFilePath = Path.Combine("db", "database.db");

builder.Services.AddDbContext<DatabaseContext>(options =>
{
options.UseSqlite("Data Source=db\\database.db");
options.UseSqlite($"Data Source={dbFilePath}");
});

// 我們允許透過 docker-compose 的系統參數變動 appSettings
Expand Down

0 comments on commit 1039eb4

Please sign in to comment.