@@ -1,14 +1,14 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Tiku.Infrastructure;
|
||||
using Tiku.Infrastructure.Persistence;
|
||||
using Tiku.Infrastructure.Bootstrap;
|
||||
using Tiku.Application;
|
||||
using Tiku.Application.Security;
|
||||
using Tiku.Infrastructure;
|
||||
using Tiku.Infrastructure.Bootstrap;
|
||||
using Tiku.Infrastructure.Persistence;
|
||||
|
||||
var builder = Host.CreateApplicationBuilder(args);
|
||||
builder.Logging.AddFilter("Microsoft.EntityFrameworkCore", LogLevel.Warning);
|
||||
@@ -21,12 +21,10 @@ var bootstrapPlatformAdmin = args.Contains("--bootstrap-platform-admin", StringC
|
||||
var skipDevelopmentSeed = args.Contains("--skip-development-seed", StringComparer.Ordinal);
|
||||
PlatformAdminBootstrapOptions? bootstrapOptions = null;
|
||||
if (bootstrapPlatformAdmin)
|
||||
{
|
||||
bootstrapOptions = new PlatformAdminBootstrapOptions(
|
||||
RequiredBootstrapSetting(builder.Configuration, "TIKU_BOOTSTRAP_PLATFORM_ADMIN_EMAIL"),
|
||||
RequiredBootstrapSetting(builder.Configuration, "TIKU_BOOTSTRAP_PLATFORM_ADMIN_PASSWORD"),
|
||||
builder.Configuration["TIKU_BOOTSTRAP_PLATFORM_ADMIN_NAME"]);
|
||||
}
|
||||
|
||||
var connectionString =
|
||||
builder.Configuration.GetConnectionString("Database") ??
|
||||
@@ -63,7 +61,8 @@ if (bootstrapOptions is not null)
|
||||
{
|
||||
var bootstrapper = ActivatorUtilities.CreateInstance<PlatformAdminBootstrapper>(scope.ServiceProvider);
|
||||
var result = await bootstrapper.BootstrapAsync(bootstrapOptions);
|
||||
Console.WriteLine($"Platform administrator '{result.Email}' was created and must change the temporary password at first sign-in.");
|
||||
Console.WriteLine(
|
||||
$"Platform administrator '{result.Email}' was created and must change the temporary password at first sign-in.");
|
||||
}
|
||||
|
||||
static string RequiredBootstrapSetting(IConfiguration configuration, string key)
|
||||
@@ -71,4 +70,4 @@ static string RequiredBootstrapSetting(IConfiguration configuration, string key)
|
||||
return configuration[key] is { } value && !string.IsNullOrWhiteSpace(value)
|
||||
? value
|
||||
: throw new InvalidOperationException($"{key} is required with --bootstrap-platform-admin.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user