- Elsa.Studio.Wasm project (net9.0): WASM shell with Login/Dashboard/Workflows modules,
reads its backend URL from a JS-injected window.getClientConfig() so the same build
can point at any origin without a rebuild.
- Elsa.CustomServer:
- references Elsa.Studio.Wasm as a project so `dotnet publish` emits its wwwroot/
- UseBlazorFrameworkFiles + MapFallbackToPage('/_Host') serve the WASM app + SPA routes
- Pages/_Host.cshtml renders the Studio shell and injects apiUrl at request time
- Bumped Elsa server packages to 3.5.3, Studio packages to 3.7.0 (Studio release train
moved ahead of server; 3.7 Studio is compatible with 3.5 server API)
- Dockerfile: SDK/runtime 9.0, restores both csprojs before copying sources
52 lines
1.9 KiB
C#
52 lines
1.9 KiB
C#
using System.Text.Json;
|
|
using Elsa.Studio.Contracts;
|
|
using Elsa.Studio.Core.BlazorWasm.Extensions;
|
|
using Elsa.Studio.Dashboard.Extensions;
|
|
using Elsa.Studio.Extensions;
|
|
using Elsa.Studio.Authentication.ElsaIdentity.BlazorWasm.Extensions;
|
|
using Elsa.Studio.Login.BlazorWasm.Extensions;
|
|
using Elsa.Studio.Login.HttpMessageHandlers;
|
|
using Elsa.Studio.Models;
|
|
using Elsa.Studio.Options;
|
|
using Elsa.Studio.Shell;
|
|
using Elsa.Studio.Shell.Extensions;
|
|
using Elsa.Studio.Workflows.Designer.Extensions;
|
|
using Elsa.Studio.Workflows.Extensions;
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
|
using Microsoft.Extensions.Options;
|
|
using Microsoft.JSInterop;
|
|
|
|
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
|
|
|
builder.RootComponents.Add<App>("#app");
|
|
builder.RootComponents.Add<HeadOutlet>("head::after");
|
|
builder.RootComponents.RegisterCustomElsaStudioElements();
|
|
|
|
var backendApiConfig = new BackendApiConfig
|
|
{
|
|
ConfigureBackendOptions = options => builder.Configuration.GetSection("Backend").Bind(options),
|
|
ConfigureHttpClientBuilder = options => options.AuthenticationHandler = typeof(AuthenticatingApiHttpMessageHandler)
|
|
};
|
|
|
|
builder.Services.AddCore();
|
|
builder.Services.AddShell();
|
|
builder.Services.AddRemoteBackend(backendApiConfig);
|
|
builder.Services.AddLoginModule();
|
|
builder.Services.AddElsaIdentity();
|
|
builder.Services.AddDashboardModule();
|
|
builder.Services.AddWorkflowsModule();
|
|
|
|
var app = builder.Build();
|
|
|
|
// Read the backend URL from the JS-injected client config (baked into _Host.cshtml).
|
|
var js = app.Services.GetRequiredService<IJSRuntime>();
|
|
var clientConfig = await js.InvokeAsync<JsonElement>("getClientConfig");
|
|
var apiUrl = clientConfig.GetProperty("apiUrl").GetString()!;
|
|
app.Services.GetRequiredService<IOptions<BackendOptions>>().Value.Url = new Uri(apiUrl);
|
|
|
|
var startupTaskRunner = app.Services.GetRequiredService<IStartupTaskRunner>();
|
|
await startupTaskRunner.RunStartupTasksAsync();
|
|
|
|
await app.RunAsync();
|