diff --git a/backend/MuiCharts.Api/MuiCharts.Api.csproj b/backend/MuiCharts.Api/MuiCharts.Api.csproj
index 63f2990..c8baf23 100644
--- a/backend/MuiCharts.Api/MuiCharts.Api.csproj
+++ b/backend/MuiCharts.Api/MuiCharts.Api.csproj
@@ -9,6 +9,7 @@
+
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/backend/MuiCharts.Api/Program.cs b/backend/MuiCharts.Api/Program.cs
index d0d903a..7caeb6f 100644
--- a/backend/MuiCharts.Api/Program.cs
+++ b/backend/MuiCharts.Api/Program.cs
@@ -1,4 +1,5 @@
using System.Reflection;
+using LettuceEncrypt;
using MuiCharts.Infrastructure;
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
@@ -17,7 +18,8 @@ WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
{
options.SuppressAsyncSuffixInActionNames = false;
});
- builder.Services.AddInfrastructure();
+
+ builder.AddInfrastructure();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(options =>
@@ -26,6 +28,10 @@ WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
string xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFileName);
options.IncludeXmlComments(xmlPath);
});
+
+ if (builder.Configuration.GetSection("LettuceEncrypt").Exists())
+ builder.Services.AddLettuceEncrypt()
+ .PersistDataToDirectory(new DirectoryInfo("/persistence"), null);
}
WebApplication app = builder.Build();
@@ -35,7 +41,9 @@ WebApplication app = builder.Build();
app.UseSwagger();
app.UseSwaggerUI();
- // app.UseHttpsRedirection();
+ if (app.Configuration.GetSection("LettuceEncrypt").Exists())
+ app.UseHttpsRedirection();
+
app.MapControllers();
app.Run();
diff --git a/backend/MuiCharts.Api/appsettings.Development.json b/backend/MuiCharts.Api/appsettings.Development.json
index a919448..78e579c 100644
--- a/backend/MuiCharts.Api/appsettings.Development.json
+++ b/backend/MuiCharts.Api/appsettings.Development.json
@@ -4,5 +4,8 @@
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
+ },
+ "ConnectionStrings": {
+ "DataContext": "Data Source=app.db"
}
}
diff --git a/backend/MuiCharts.Api/appsettings.json b/backend/MuiCharts.Api/appsettings.json
index 2f36700..943f5d5 100644
--- a/backend/MuiCharts.Api/appsettings.json
+++ b/backend/MuiCharts.Api/appsettings.json
@@ -5,5 +5,8 @@
"Microsoft.AspNetCore": "Warning"
}
},
- "AllowedHosts": "*"
+ "AllowedHosts": "*",
+ "ConnectionStrings": {
+ "DataContext": "Data Source=/persistence/data.db"
+ }
}
diff --git a/backend/MuiCharts.Infrastructure/DataContext.cs b/backend/MuiCharts.Infrastructure/DataContext.cs
index 168d9d3..c5b60a0 100644
--- a/backend/MuiCharts.Infrastructure/DataContext.cs
+++ b/backend/MuiCharts.Infrastructure/DataContext.cs
@@ -19,20 +19,13 @@ public class DataContext : DbContext
///
public DbSet
-
+