For the complete documentation index, see llms.txt. This page is also available as Markdown.

Retrieving application configuration

Interface api.config.v1 allows reading the platform's global configuration parameters of Eximee directly from the business logic code. Using this API makes it possible to decouple scripts from "hardcoded" values (so-called hardcoding), which makes it easier to manage URLs of external services, business constants, or feature flags across different environments (test, production, etc.).

The configuration API can be used globally, across all types of programming inserts: in scripts (scriptService), process tasks (scriptTask) and script validators (validationScript).

API methods

The configuration interface provides two main data read methods. They always return text values (String). When storing numbers or complex structures (e.g. JSON), the developer must parse the result themselves.

Method
Return type
Operation description

get(key)

String

Retrieves the assigned value for the specified key. If the key does not exist in the configuration, the method throws an exception.

getOrDefault(key, defaultValue)

String

Retrieves the value for the key. If the key does not exist or has not been set, the method returns the specified value defaultValue without interrupting the script execution.

Usage examples

It is recommended to use the method getOrDefault to retrieve parameters that are not critical for process operation, whereas the method get in a try-catch block for mandatory parameters, so that missing configuration can be handled precisely.

function callService(context) {
    let appUrl;
    let timeoutLimit;
    
    // 1. Safely retrieve the required key with error handling (try-catch)
    try {
        appUrl = api.config.v1.get("application.url");
    } catch (error) {
        Logger.warn("Missing critical key 'application.url' in configuration: {}", error);
        appUrl = "[https://default.url.com](https://default.url.com)"; // Assign fallback value
    }
    
    // 2. Retrieve with a default value - recommended solution, shorter to write
    timeoutLimit = api.config.v1.getOrDefault("integration.timeout_ms", "5000");
    
    // Return the retrieved values (they can be used, for example, as input parameters to ServiceProxy)
    return [{
        'url': appUrl, 
        'timeout': timeoutLimit
    }];
}

More information: Configuration from Low-code

Last updated

Was this helpful?