elsa-core/samples/aspnet/Elsa.Samples.AspNet.CustomUIHandler/Program.cs
jdevillard 3083a400d8
Add Variable available in dropdown when configuring a activity input (#5918)
* Sample to provide a ExpressionDescriptorProvider

* fix variable accessor in VariableExpressionHandler

* remove Variable Expression to use default one

* Change the Variable Expression Provider to handle Variable Expression correctly

* need to check on UI Side and Server side is valid JSON is sent. For example, if a use change from a literal value to a Variable value, the value is sent to the API and result in an exception, we cannot handle invalid json  without using Try/Catch

---------

Co-authored-by: Jérémie DEVILLARD <jdevillard@users.noreply.github.com>
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
2024-08-30 12:01:44 +02:00

47 lines
1.4 KiB
C#

using Elsa.EntityFrameworkCore.Extensions;
using Elsa.EntityFrameworkCore.Modules.Management;
using Elsa.EntityFrameworkCore.Modules.Runtime;
using Elsa.Extensions;
using Elsa.Samples.AspNet.CustomUIHandler;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddElsa(elsa =>
{
elsa.UseWorkflowManagement(management => management.UseEntityFrameworkCore(ef => ef.UseSqlite()));
elsa.UseWorkflowRuntime(runtime => runtime.UseEntityFrameworkCore(ef=>ef.UseSqlite()));
elsa.UseWorkflowsApi();
elsa.UseHttp();
elsa.UseJavaScript();
elsa.UseLiquid();
elsa.UseIdentity(identity =>
{
identity.UseAdminUserProvider();
identity.TokenOptions = options =>
{
options.SigningKey = "c7dc81876a782d502084763fa322429fca015941eac90ce8ca7ad95fc8752035";
options.AccessTokenLifetime = TimeSpan.FromDays(1);
};
});
elsa.UseDefaultAuthentication();
elsa.AddActivity<VehicleActivity>();
});
builder.Services.AddSingleton<VehicleUIHandler>();
builder.Services.AddCors(cors => cors.AddDefaultPolicy(policy => policy.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin()));
var app = builder.Build();
// Configure the HTTP request pipeline.
app.UseHttpsRedirection();
app.UseCors();
app.UseAuthentication();
app.UseAuthorization();
app.UseWorkflowsApi();
app.Map("/test",c=> c.UseWorkflows());
app.Run();