Variables
Last updated
Last updated
Variables are dynamic values you can include in sync jobs. Use the "@" prefix to reference these variables in other parts of your sync configuration. During job execution, you might be prompted to input these values.
Execution variables can be either provided at runtime or computed using a formula. Optionally, you can pass the name
attribute value as a command line option using param-values
.
You can choose to just use plain text in the Name field of the Variable or you can use a calculated formula.
The following formulas are currently supported by Connections.
Cinchy supports .NET regular expressions. For more information, please see the Microsoft .NET Expressions page.
FILENAME(<some-path>, <some-regex>)
1. File path 2. Regex with match group
Applies regex to file name only, excluding the directory.
To extract specific data from a file name.
FILEPATH(<some-path>, <some-regex>)
1. File path 2. Regex with match group
Applies regex to the full file path, including the directory.
To extract specific data from a full file path.
GUID()
None
Generates a random GUID.
To create a unique identifier during sync.
GETSECRETVALUE(domain, secretname)
Domain, Secret name
Retrieves a secret from the Cinchy Secrets Table.
To insert sensitive information like a connection string.
ENV(<place-environment-variable-here>)
Environment variable
Uses an available environment variable.
To insert an environment variable value.
Avoid using the ENV formula for credentials.
Below are the three Variable examples shown in the Connections experience, followed by the relevant XML:
A name attribute reference an execution variable (Image 2). You can use this when pulling in a local file for an Excel sync and specify the path to your file on your machine.
The FILEPATH function takes in two variables:
A reference to the first variable, such as a file path.
A regular expression that includes a match group (Image 3). The first match group's value is assigned to the variable. FILEPATH function executes regex against the full file path (including the directory structure). For the full formula, see the XML example below.
The FILENAME function takes in two variables:
A reference to the first variable, such as a file path.
A regular expression that includes a match group (Image 4). The first match group's value is what gets assigned to the variable. FILENAME function applies the regex only to the name of the file (excluding the directory structure).
The ENV formula uses an environment variable available in the connections/worker pods as the value of the variable (Image 5). An example use case for this would be a situation where the URLs used in a REST API sync is different across environments -- instead of manually updating the syncs with the various URLs, you can use this formula to automatically calculated it from your pod configuration files.
Example 5: The GETSECRETVALUE formula (Image 6) is input as a variable for a REST Source and is used to call a secret from the Cinchy Secrets Table.
This secret can then be used in the REST Header (Image 7).
While in the UI the term is variables, the paired XML configuration uses the term parameters.
This section details how to configure your platform to use Environment Variables.
To create or change environment variables on Windows:
On the Windows taskbar, right-click the Windows Icon > System.
In the Settings window, click Related Settings > Advanced System Settings > Environment Variables (Image 8).
Under System Variables, click New to create your new environment variable (Image 9).
To configure an environment variable in Kubernetes, do the following:
Navigate to your cinchy.kubernetes\environment\_kustomizations\_template\instance\_template\connections\kustomization.yaml
file.
Under patchesJson6902 > patch, add your environment variable as shown in the code snippet below. Input your own namespace and variable name where indicated.
Navigate to your platform_components/connections/connections-app.yaml file.
Under Spec > Template > Spec > Containers > ENV, add in your environment variable. This addition depends on what value you are using as an environment variable. The below code snippet shows a basic example:
Make the same change to the platform_components/worker/worker-app.yaml file.
Push and merge your changes.