Domain Metadata

This section discusses how to use domain metadata. i.e. specific to the application. Domain metadata is useful for writing easily configurable applications.

  • Domain metadata file stores configuration settings and parameters external to the source code, enabling easy modification and customization of an application without code changes.

  • This makes it easier to adapt the application to different environments such as development, testing, production, etc.

  • For security reasons, sensitive information such as passwords, API keys, and credentials should not be hard-coded in the functions. Externalizing these values into Domain metadata files allows for more secure handling of sensitive data.

  • Trillo Workbench does not enforce any shcema or type. You can use XML, JSON, text, HTML etc. files as appropriate.

Example:

  • Create a file under Metadata File > files.

  • Name the file - configDev.json(for dev), configQa.json(for QA), config.json (for PROD).

  • Add properties in the configDev.json file and click on save.

  • We can reference the config file from any functions using the below code -

String configFile = parameters.get("configFile")
Map<String, Object> configs =
  MetaApi.getDomainFileAsMap("shared/domainMeta/files/" + configFile);

Last updated