optimajet / WorkflowServer

Workflow Server is a ready-to-use Workflow Engine-based application that you can deploy into your infrastructure. It can be integrated with NodeJS, PHP, Ruby, .NET, or Java applications via a REST API. Workflow Server is a key component for managing the lifecycle of business objects within your enterprise.
https://workflowserver.io
197 stars 56 forks source link

config.json multiple environments #17

Open sadiomanhne opened 2 months ago

sadiomanhne commented 2 months ago

How can I setup to load the configuration from config.*.json (* is an ASPNETCORE_ENVIRONMENT variable, eg: DEV, PROD)?

rylee-soll commented 2 months ago

Hi @sadiomanhne ,

Workflow Server is not based on the ASP.NET framework, so features of this framework are not supported, including the creation of configuration files with the ASPNETCORE_ENVIRONMENT in their name.

However, you can implement similar functionality by yourself, as the configuration can be set not only through a file but also in the code. When calling WorkflowServerInitializer.BuildWebHost, you can pass a lambda expression whose argument has the property WorkflowServerRuntime.ServerSettings. This property contains settings from the configuration, and you can set their values using any source.

var initializer = new WorkflowServerInitializer(consoleLog: true, eventLog: false, moveUpBackendFolderIfConfig: false);

(bool success, IWebHost host) = initializer.BuildWebHost(workflowServer =>
{
    workflowServer.ServerSettings.Provider = "mssql";
    workflowServer.ServerSettings.ConnectionString = "Data Source=(local);Initial Catalog=WorkflowServer;User ID=sa;Password=1;";
});

Best regards,
Rylee, OptimaJet Developer.