mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
3.0 KiB
80 lines
3.0 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschränkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using System.Net;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Squidex.Areas.IdentityServer.Config;
|
|
using Squidex.Config.Domain;
|
|
using Squidex.Config.Orleans;
|
|
using Squidex.Config.Startup;
|
|
|
|
namespace Squidex
|
|
{
|
|
public static class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
CreateHostBuilder(args).Build().Run();
|
|
}
|
|
|
|
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
|
Host.CreateDefaultBuilder(args)
|
|
.ConfigureLogging((context, builder) =>
|
|
{
|
|
builder.ConfigureForSquidex(context.Configuration);
|
|
})
|
|
.ConfigureAppConfiguration((hostContext, builder) =>
|
|
{
|
|
builder.ConfigureForSquidex();
|
|
})
|
|
.ConfigureServices(services =>
|
|
{
|
|
// Step 0: Log all configuration.
|
|
services.AddHostedService<LogConfigurationHost>();
|
|
|
|
// Step 1: Initialize all services.
|
|
services.AddHostedService<InitializerHost>();
|
|
|
|
// Step 2: Create admin user.
|
|
services.AddHostedService<CreateAdminHost>();
|
|
})
|
|
.UseOrleans((context, builder) =>
|
|
{
|
|
// Step 3: Start Orleans.
|
|
builder.ConfigureForSquidex(context.Configuration);
|
|
})
|
|
.ConfigureServices(services =>
|
|
{
|
|
// Step 4: Run migration.
|
|
services.AddHostedService<MigratorHost>();
|
|
|
|
// Step 5: Run rebuild processes.
|
|
services.AddHostedService<MigrationRebuilderHost>();
|
|
|
|
// Step 6: Start background processes.
|
|
services.AddHostedService<BackgroundHost>();
|
|
})
|
|
.ConfigureWebHostDefaults(builder =>
|
|
{
|
|
builder.ConfigureKestrel((context, serverOptions) =>
|
|
{
|
|
if (context.HostingEnvironment.IsDevelopment() || context.Configuration.GetValue<bool>("devMode:enable"))
|
|
{
|
|
serverOptions.Listen(
|
|
IPAddress.Any,
|
|
5001,
|
|
listenOptions => listenOptions.UseHttps("../../../dev/squidex-dev.pfx", "password"));
|
|
}
|
|
});
|
|
|
|
builder.UseStartup<Startup>();
|
|
});
|
|
}
|
|
}
|
|
|