mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
fix: update database connection string configuration in Program.cs and docker-compose.yml
This commit is contained in:
@@ -17,15 +17,13 @@ namespace SharpbinV3.Server
|
|||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
var connectionString = Environment.GetEnvironmentVariable("SQLITE_CONN")
|
|
||||||
?? builder.Configuration.GetConnectionString("Default");
|
|
||||||
|
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
||||||
builder.Services.AddOpenApi();
|
builder.Services.AddOpenApi();
|
||||||
builder.Services.AddDbContext<AppDbContext>(opt =>
|
builder.Services.AddDbContext<AppDbContext>(opt =>
|
||||||
{
|
{
|
||||||
opt.UseSqlite(connectionString);
|
opt.UseSqlite(builder.Configuration.GetConnectionString("DefaultConnection"));
|
||||||
});
|
});
|
||||||
builder.Services.AddSingleton<ICompressionService, CompressionService>();
|
builder.Services.AddSingleton<ICompressionService, CompressionService>();
|
||||||
builder.Services.AddSingleton<IHostedService, PasteCleanUpService>();
|
builder.Services.AddSingleton<IHostedService, PasteCleanUpService>();
|
||||||
|
|||||||
+2
-1
@@ -7,9 +7,10 @@ services:
|
|||||||
container_name: sharpbin-backend
|
container_name: sharpbin-backend
|
||||||
environment:
|
environment:
|
||||||
ASPNETCORE_ENVIRONMENT: Production
|
ASPNETCORE_ENVIRONMENT: Production
|
||||||
SQLITE_CONN: "Data Source=/app/data/sharpbin.db"
|
ConnectionStrings__DefaultConnection: "Data Source=/app/data/sharpbin.db"
|
||||||
volumes:
|
volumes:
|
||||||
- sharpbin-data:/app/data
|
- sharpbin-data:/app/data
|
||||||
|
- ./SharpbinV3.Server/appsettings.json:/app/appsettings.json
|
||||||
networks:
|
networks:
|
||||||
- sharpbin-net
|
- sharpbin-net
|
||||||
expose:
|
expose:
|
||||||
|
|||||||
Reference in New Issue
Block a user