WORKS
This commit is contained in:
@@ -7,6 +7,9 @@
|
||||
dockerfile: src/Printbase.WebApi/Dockerfile
|
||||
ports:
|
||||
- "${WEBAPI_PORT}:8080"
|
||||
environment:
|
||||
- ConnectionStrings__DefaultConnection=Server=db;Database=PrintbaseDb;User Id=sa;Password=${SA_PASSWORD};TrustServerCertificate=True;
|
||||
- ASPNETCORE_ENVIRONMENT=Development
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.1.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Reflection;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Printbase.Application.Products.Commands.CreateProduct;
|
||||
using Printbase.Domain.Repositories;
|
||||
using Printbase.Infrastructure.Database;
|
||||
using Printbase.Infrastructure.Mapping;
|
||||
@@ -18,7 +19,11 @@ public static class Startup
|
||||
builder.Configuration.GetConnectionString("DefaultConnection"),
|
||||
b => b.MigrationsAssembly(typeof(ApplicationDbContext).Assembly.FullName)));
|
||||
|
||||
services.AddMediatR(cfg => cfg.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly()));
|
||||
services.AddMediatR(cfg => {
|
||||
cfg.RegisterServicesFromAssembly(typeof(CreateProductCommand).Assembly);
|
||||
|
||||
cfg.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly());
|
||||
});
|
||||
|
||||
services.AddScoped<IProductRepository, ProductRepository>();
|
||||
services.AddScoped<IProductVariantRepository, ProductVariantRepository>();
|
||||
@@ -26,7 +31,8 @@ public static class Startup
|
||||
services.AddScoped<IProductGroupRepository, ProductGroupRepository>();
|
||||
|
||||
services.AddAutoMapper(typeof(ProductMappingProfile).Assembly);
|
||||
|
||||
services.AddSwaggerGen();
|
||||
services.AddControllers();
|
||||
services.AddOpenApi();
|
||||
}
|
||||
|
||||
@@ -47,13 +53,16 @@ public static class Startup
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
Console.WriteLine("Development environment variables applied");
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Production environment variables applied");
|
||||
app.UseExceptionHandler("/Error");
|
||||
app.UseHsts();
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
"Microsoft.AspNetCore": "Debug",
|
||||
"Microsoft.EntityFrameworkCore": "Information"
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Server=localhost,${SQL_PORT};Database=PrintbaseDb;User Id=sa;Password=${SA_PASSWORD};TrustServerCertificate=True;"
|
||||
"DefaultConnection": "Server=db;Database=PrintbaseDb;User Id=sa;Password=Str0ng!Passw0rd383838@@@$23;TrustServerCertificate=True;"
|
||||
},
|
||||
"DatabaseOptions": {
|
||||
"ApplyMigrationsAtStartup": true
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
"Microsoft.AspNetCore": "Debug",
|
||||
"Microsoft.EntityFrameworkCore": "Information"
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Server=localhost,${SQL_PORT};Database=PrintbaseDb;User Id=sa;Password=${SA_PASSWORD};TrustServerCertificate=True;"
|
||||
"DefaultConnection": "Server=db;Database=PrintbaseDb;User Id=sa;Password=Str0ng!Passw0rd383838@@@$23;TrustServerCertificate=True;"
|
||||
},
|
||||
"DatabaseOptions": {
|
||||
"ApplyMigrationsAtStartup": true
|
||||
|
||||
Reference in New Issue
Block a user