Workspaces Configuration Overview
Workspaces 21.11 has a unique take on configuration. We encourage the use of TypeScript to write config definitions providing architects with better validation and error handling, while keeping configurations modular and making them extendable.
Our template comes with a set of configs that include default values for common use cases, so you don't need to start from scratch when creating your config files even if you are developing a new solution. Nevertheless, it can be helpful to have a high-level understanding of how the configurations are designed and implemented.
Keeping a well maintained configs
folder will help you to keep your Workspaces easy to modify, easy to extend and easy to upgrade.
Structure and usage
transact-config.json
is the root-level configuration file for specifying which configs and fixtures you want to use, in addition to providing configuration options for deployment and idleTime.
Let's review an example to see how the configuration works:
{
"buildDir": "build",
"domainModelFile": "transact-schema.json",
"appDef": {
"name": "Workspaces",
"formCode": "workspaces",
"clientCode": "workspaces",
"configPath": "development",
"idleTime": 3600000,
"transactInsights": false,
"formVersion": {
"versionNumber": "21.11"
}
}
}
"configPath": "development"
in this case specifies that src/configs/development
is used for the configuration files and src/fixtures/development
is used for the test data provided to the app in the development environment.
Space configuration
Inside each sub-folder under src/configs
, there is an index.ts
that imports all the other files in the folder. This is our root config, and its purpose is to export only the spaces config that we want to use.
import global from './global';
import manage from './manage';
import process from './process';
import helpdesk from './helpdesk';
import assistedChannel from './assistedChannel';
const spaces = [process, helpdesk, assistedChannel, manage];
export default {
global,
spaces,
};
All exports are lowercase and they represent the space id that's going to be used by global.ts
in its spaces
configuration. The global
export is the only mandatory export; other exports represent different spaces you've configured, so names can vary depending on the solution. To learn more about config definitions, see Global Configuration and Current Space Configuration.
Once you have decided what config
and fixture
best suit your needs, it's time to copy them and create new folders called src/configs/custom
and src/fixtures/custom
, and import them inside src/index.ts
. Your browser will reload, serving your new config.