Merge branch 'arrays_in_appsettings' of https://github.com/elsa-workflows/elsa-core into arrays_in_appsettings

This commit is contained in:
axeleron007 2021-07-06 15:01:24 +03:00
commit 4d0aec12c2
7 changed files with 39 additions and 20 deletions

View file

@ -96,7 +96,7 @@ Check out the [Quickstart guides](https://elsa-workflows.github.io/elsa-core/doc
A quick and easy way to give Elsa a spin is to run the following Docker command:
```bash
docker run -t -i -e ELSA__HTTP__BASEURL='http://localhost:13000' -p 13000:80 elsaworkflows/elsa-dashboard-and-server:latest
docker run -t -i -e ELSA__SERVER__BASEURL='http://localhost:13000' -p 13000:80 elsaworkflows/elsa-dashboard-and-server:latest
```
Then navigate to http://localhost:13000.

View file

@ -42,7 +42,7 @@ namespace Elsa.Activities.Http
if (response.HasStarted)
return Fault(T["Response has already started"]!);
return new RedirectResult(_httpContextAccessor, Location, Permanent);
return Combine(new RedirectResult(_httpContextAccessor, Location, Permanent), Done());
}
}
}

View file

@ -15,6 +15,9 @@ namespace Elsa
public static ElsaOptionsBuilder AddFeatures(this ElsaOptionsBuilder builder, IEnumerable<Assembly> assemblies, IConfiguration configuration)
{
if (builder.ElsaOptions.FeatureOptions.Features == null!) // Null when configuration binding finds an empty array.
return builder;
var enabledFeatures = builder.ElsaOptions.FeatureOptions.Features.ToHashSet();
var startupTypesQuery = from assembly in assemblies

View file

@ -15,6 +15,8 @@
<body>
<elsa-studio-root server-url="https://localhost:11000" monaco-lib-path="build/assets/js/monaco-editor/min"></elsa-studio-root>
<!--<elsa-workflow-definition-editor-screen server-url="https://localhost:11000" monaco-lib-path="build/assets/js/monaco-editor/min"></elsa-workflow-definition-editor-screen>-->
<!--<elsa-external-events></elsa-external-events>-->
<!--<elsa-studio-root server-url="https://localhost:5001" monaco-lib-path="build/assets/js/monaco-editor/min"></elsa-studio-root>-->
<!--<elsa-studio-root server-url="https://localhost:6080" monaco-lib-path="build/assets/js/monaco-editor/min"></elsa-studio-root>-->
<!--<elsa-studio-root server-url="https://skynet-workflow.azurewebsites.net" monaco-lib-path="build/assets/js/monaco-editor/min"></elsa-studio-root>-->
@ -30,11 +32,6 @@
service.register({
onRequest(request) {
console.log('onRequest');
request.headers = {
...request.headers,
'X-Client': 'Elsa Dashboard',
Authorization: 'Bearer secret-token' // For example, set a JWT value here.
};
return request;
},

View file

@ -0,0 +1,17 @@
using Elsa;
using Elsa.Attributes;
using Elsa.Services.Startup;
using ElsaDashboard.Samples.AspNetCore.Monolith.Workflows;
using Microsoft.Extensions.Configuration;
namespace ElsaDashboard.Samples.AspNetCore.Monolith
{
[Feature("Workflows:Heartbeat")]
public class HeartbeatWorkflowsFeature : StartupBase
{
public override void ConfigureElsa(ElsaOptionsBuilder elsa, IConfiguration configuration)
{
elsa.AddWorkflow<HeartbeatWorkflow>();
}
}
}

View file

@ -1,3 +1,4 @@
using System.Collections.Generic;
using Elsa;
using Elsa.Persistence.EntityFramework.Core.Extensions;
using Elsa.Persistence.EntityFramework.Sqlite;
@ -22,26 +23,26 @@ namespace ElsaDashboard.Samples.AspNetCore.Monolith
public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages();
// Elsa Server.
var elsaSection = Configuration.GetSection("Elsa");
services
.AddElsa(options => options
.UseEntityFrameworkPersistence(ef => ef.UseSqlite())
.AddConsoleActivities()
.AddHttpActivities(elsaSection.GetSection("Server").Bind)
.AddEmailActivities(elsaSection.GetSection("Smtp").Bind)
.AddQuartzTemporalActivities()
.AddJavaScriptActivities()
.AddActivitiesFrom<Startup>()
.AddWorkflowsFrom<Startup>()
.UseEntityFrameworkPersistence(ef => ef.UseSqlite())
.AddConsoleActivities()
.AddHttpActivities(elsaSection.GetSection("Server").Bind)
.AddEmailActivities(elsaSection.GetSection("Smtp").Bind)
.AddQuartzTemporalActivities()
.AddJavaScriptActivities()
.AddActivitiesFrom<Startup>()
.AddFeatures(new[] { typeof(Startup) }, Configuration, elsaSection.GetSection("Features").Get<List<string>>())
);
services
.AddElsaSwagger()
.AddElsaApiEndpoints();
// Allow arbitrary client browser apps to access the API.
// In a production environment, make sure to allow only origins you trust.
services.AddCors(cors => cors.AddDefaultPolicy(policy => policy.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin().WithExposedHeaders("Content-Disposition")));
@ -72,9 +73,9 @@ namespace ElsaDashboard.Samples.AspNetCore.Monolith
{
// Elsa Server uses ASP.NET Core Controllers.
endpoints.MapControllers();
endpoints.MapFallbackToPage("/_Host");
});
}
}
}
}

View file

@ -8,6 +8,7 @@
},
"AllowedHosts": "*",
"Elsa": {
"Features": [],
"Server": {
"BaseUrl": "https://localhost:15265",
"BasePath": "/workflows"