Skip to content

Commit 55be5e6

Browse files
nanotaboadaclaude
andcommitted
fix(data): guard against empty STORAGE_PATH and fix ADR markdown lint (#459)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 73e1f84 commit 55be5e6

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

adr/0003-use-sqlite-for-data-storage.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ We will use SQLite as the database engine, accessed through Entity Framework Cor
1919
## Consequences
2020

2121
### Positive
22+
2223
- Zero-config: no server process, no connection string credentials, no Docker service dependency for local development.
2324
- EF Core abstracts the SQL dialect, so migrating to another database requires changing only the provider registration.
2425
- `MigrateAsync()` at startup ensures the schema is always up to date, making onboarding instant without committing binary database files.

src/Dotnet.Samples.AspNetCore.WebApi/Extensions/ServiceCollectionExtensions.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ IWebHostEnvironment environment
3131
{
3232
services.AddDbContextPool<PlayerDbContext>(options =>
3333
{
34-
var dataSource =
35-
Environment.GetEnvironmentVariable("STORAGE_PATH")
36-
?? Path.Combine(AppContext.BaseDirectory, "storage", "players-sqlite3.db");
34+
var storagePath = Environment.GetEnvironmentVariable("STORAGE_PATH");
35+
var dataSource = !string.IsNullOrWhiteSpace(storagePath)
36+
? storagePath
37+
: Path.Combine(AppContext.BaseDirectory, "storage", "players-sqlite3.db");
3738

3839
var storageDir = Path.GetDirectoryName(dataSource);
3940
if (!string.IsNullOrWhiteSpace(storageDir))

0 commit comments

Comments
 (0)