46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
|
|
using Elsa.EntityFrameworkCore.Modules.Management;
|
||
|
|
using Elsa.EntityFrameworkCore.Sqlite.Modules.Management;
|
||
|
|
using Elsa.Extensions;
|
||
|
|
using Elsa.Http.Extensions;
|
||
|
|
using Elsa.Identity.Extensions;
|
||
|
|
using Elsa.Workflows.Management.Extensions;
|
||
|
|
|
||
|
|
var builder = WebApplication.CreateBuilder(args);
|
||
|
|
|
||
|
|
// Add services to the container.
|
||
|
|
builder.Services.AddElsa(elsa =>
|
||
|
|
{
|
||
|
|
// Configure management feature to use EF Core.
|
||
|
|
elsa.UseWorkflowManagement(management => management.UseEntityFrameworkCore(ef => ef.UseSqlite()));
|
||
|
|
|
||
|
|
// Expose API endpoints.
|
||
|
|
elsa.UseWorkflowsApi();
|
||
|
|
|
||
|
|
// Add services for HTTP activities and workflow middleware.
|
||
|
|
elsa.UseHttp();
|
||
|
|
|
||
|
|
// Configure identity so that we can create a default admin user.
|
||
|
|
elsa.UseIdentity(identity =>
|
||
|
|
{
|
||
|
|
identity.CreateDefaultUser = builder.Environment.IsDevelopment();
|
||
|
|
identity.IdentityOptions.SigningKey = "secret-token-signing-key";
|
||
|
|
});
|
||
|
|
|
||
|
|
// Use default authentication (JWT).
|
||
|
|
elsa.UseDefaultAuthentication();
|
||
|
|
});
|
||
|
|
|
||
|
|
// Add Razor pages.
|
||
|
|
builder.Services.AddRazorPages();
|
||
|
|
|
||
|
|
var app = builder.Build();
|
||
|
|
|
||
|
|
// Configure the HTTP request pipeline.
|
||
|
|
app.UseHttpsRedirection();
|
||
|
|
app.UseStaticFiles();
|
||
|
|
app.UseAuthentication();
|
||
|
|
app.UseAuthorization();
|
||
|
|
app.UseWorkflowsApi();
|
||
|
|
app.UseWorkflows();
|
||
|
|
app.MapRazorPages();
|
||
|
|
app.Run();
|