Local development
Both worker applications and applications that create and manage tasks and state can be configured to run in isolation mode.
When running in isolation mode, tasks, state, and workers operate independently from the Taskurai instance:
- Tasks created in isolation mode are not visible to workers deployed in the Taskurai instance
- State created in isolation mode is not visible to workers deployed in the Taskurai instance
- Local workers do not receive tasks or state from the Taskurai instance
- Cron jobs created in isolation mode produce tasks in isolation mode
- Webhooks created in isolation mode only handle tasks created in isolation mode
Important: To enable isolation mode during development, the same isolation key must be used by both:
- the application creating tasks
- the local worker
This is required for isolation mode to function correctly.
A PAT includes a default isolation key. You can either:
- Use the same PAT in both the worker and the task-creating application, or
- Override the isolation key by configuring the same unique GUID in both applications:
- via the
Taskurai:IsolationKeyapplication setting - via TaskuraiClientOptions
- via the
Isolation mode is intended for local development only.
Workers deployed 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.
- C#
{
...
"Taskurai": {
"IsolationMode": true
},
...
}
Optionally, it is possible to override the isolation key:
{
...
"Taskurai": {
"IsolationMode": true,
"IsolationKey": "85666c46-92ff-4eae-91dd-21e9ed74f376"
},
...
}
Configure the Application using Tasks and State
For the application that handles tasks, configure it based on its type (console, service, asp.net, etc.).
- C#
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:
{
"Taskurai": {
"IsolationMode": true
}
}
Optionally, it is possible to override the **isolation key**:
{
"Taskurai": {
"IsolationMode": true,
"IsolationKey": "85666c46-92ff-4eae-91dd-21e9ed74f376"
}
}
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.
- C#
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..."
To access user secrets, make sure your development environment (use the DOTNET_ENVIRONMENT variable) is set to Development.