feature/infrastructure-setup #1
6 changed files with 36 additions and 8 deletions
|
|
@ -10,7 +10,7 @@
|
|||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.16" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@ builder.Services.AddOpenApi();
|
|||
// INFRASTRUCTURE LAYER - Database & External Services
|
||||
// ============================================
|
||||
|
||||
// Add DbContext with SQLite (can be changed to SQL Server, PostgreSQL, etc.)
|
||||
// Add DbContext with PostgreSQL
|
||||
builder.Services.AddDbContext<AppDbContext>(options =>
|
||||
{
|
||||
// Using SQLite for development - configure in appsettings.json for production
|
||||
options.UseSqlite(builder.Configuration.GetConnectionString("DefaultConnection")
|
||||
?? "Data Source=germanapp.db");
|
||||
// Using PostgreSQL for production and development
|
||||
options.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection")
|
||||
?? "Host=localhost;Port=5432;Database=DeutschLernen;Username=postgres;Password=postgres");
|
||||
|
||||
// Enable sensitive data logging in development
|
||||
if (builder.Environment.IsDevelopment())
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
"Default": "Debug",
|
||||
"Microsoft.AspNetCore": "Information"
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Host=localhost;Port=5432;Database=DeutschLernen;Username=postgres;Password=postgres"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
11
GermanApp/appsettings.Production.json
Normal file
11
GermanApp/appsettings.Production.json
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Warning",
|
||||
"Microsoft.AspNetCore": "Error"
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Host=prod-db;Port=5432;Database=DeutschLernen;Username=postgres;Password=${DB_PASSWORD}"
|
||||
}
|
||||
}
|
||||
11
GermanApp/appsettings.Staging.json
Normal file
11
GermanApp/appsettings.Staging.json
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Host=staging-db;Port=5432;Database=DeutschLernen;Username=postgres;Password=${DB_PASSWORD}"
|
||||
}
|
||||
}
|
||||
|
|
@ -5,5 +5,8 @@
|
|||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Host=localhost;Port=5432;Database=DeutschLernen;Username=postgres;Password=postgres"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue