#26 reworked migrations, preparation for deployement

This commit is contained in:
Dominic Villemure
2024-04-21 10:50:35 -04:00
parent 6dc85438bf
commit 5a23b945cd
24 changed files with 327 additions and 2543 deletions

View File

@@ -4,9 +4,16 @@ using Hutopy.Infrastructure;
using Hutopy.Infrastructure.Data;
using Hutopy.Infrastructure.Services;
using Hutopy.Web;
using Azure.Identity;
var builder = WebApplication.CreateBuilder(args);
if (!builder.Environment.IsDevelopment())
{
var keyVaultEndpoint = new Uri(Environment.GetEnvironmentVariable("VaultUri") ?? "");
builder.Configuration.AddAzureKeyVault(keyVaultEndpoint, new DefaultAzureCredential());
}
builder.Services.AddCors(options =>
{
options.AddPolicy("AllowAll", builder =>
@@ -30,12 +37,11 @@ var app = builder.Build();
app.UseCors("AllowAll");
// Initialize and seed the db.
await app.InitialiseDatabaseAsync();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
await app.InitialiseDatabaseAsync();
}
else
if (!app.Environment.IsDevelopment())
{
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();