* Incremental work on samples * Rename HTTP middleware and update samples * Rename HTTP Activities to Workflows * Automatically register core activities when adding Elsa * Fix feature registration bug * Add default auth feature * Make activity serializer more flexible * Bump designer version * Add workflow server + designer samples * Simplify EntityFrameworkCore projects * Update solution * Add Sqlite package references to ensure the correct version is used * Update sample project with EF Core * Update EF extensions * Add server + designer sample project * Cleanup AllInOne project and add some XML comments * Rename ci.yml and add CI for Docker file
45 lines
1.4 KiB
C#
45 lines
1.4 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();
|
|
});
|
|
|
|
// Configure CORS to allow designer app hosted on a different origin to invoke the APIs.
|
|
builder.Services.AddCors(cors => cors.AddDefaultPolicy(policy => policy.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod()));
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
app.UseHttpsRedirection();
|
|
app.UseCors();
|
|
app.UseAuthentication();
|
|
app.UseAuthorization();
|
|
app.UseWorkflowsApi();
|
|
app.UseWorkflows();
|
|
app.Run(); |