Skip to main content

Local Development

Both worker applications and applications that create and manage tasks can be configured to run in isolation mode.

When running in isolation mode, tasks and workers operate independently from the Taskurai instance:

  • All tasks created are not visible to the workers deployed in the Taskurai instance.
  • The local worker application does not receive any tasks created for workers deployed to the Taskurai instance.

To enable isolation mode during development, use the same Personal Access Token (PAT) for both the worker application and the application that creates tasks.

caution

Isolation mode is intended for local development only. Containers running in Taskurai should not have isolation mode configured.

Configure the Worker Application

To configure the worker application, turn on the isolation mode in the worker configuration.

appsettings.Development.json
{
...
"Taskurai": {
"IsolationMode": true
},
...
}

Configure the Application using Tasks

For the application that handles tasks, configure it based on its type (console, service, asp.net, etc.).

This sample assumes an application that has appsettings.json in place:

// Setup Taskurai client
var taskurai = new TaskuraiClient(configuration["Taskurai:Pat"], new TaskuraiClientOptions()
{
IsolationMode = configuration.GetValue<bool>("Taskurai:IsolationMode", true)
});

Application configuration:

appsettings.Development.json
{
"Taskurai": {
"IsolationMode": true
}
}

Securely storing access tokens

The access token should be stored to a secure place and do not share or check this token into source control.

For local development, it is possible to store the access token in the users secrets.

Add the personal access token as a user secret, replace the PAT with the access token you have created earlier.

dotnet user-secrets init

dotnet user-secrets set "Taskurai:Pat" "e8gFaA8ZaetAHiS257opAr..."
tip

To access user secrets, make sure your development environment (use the DOTNET_ENVIRONMENT variable) is set to Development.