Skip to main content

Expression Context Reference

Codiac expressions use JSONata — a lightweight query and transformation language for JSON. Anywhere Codiac accepts an expression, it evaluates it against a context object that describes the current deployment target.

For practical examples and recipes, see Expression Examples.

Context schema

tenant

FieldTypeDescription
tenant.codestringThe tenant identifier

enterprise

FieldTypeDescription
enterprise.namestringName of the enterprise

environment

FieldTypeDescription
environment.namestringName of the environment

cabinet

FieldTypeDescription
cabinet.namestringName of the cabinet
cabinet.namespacestringThe cabinet's internal runtime identifier
cabinet.hostNamingarrayHost naming entries (used by the $hostmap() function)

cluster

FieldTypeDescription
cluster.namestringName of the cluster
cluster.providerstringCloud provider: "azure", "aws", or "other"
cluster.versionstringCluster version
cluster.location.codestringCloud region code (e.g. "eastus", "us-east-1")
cluster.rbacEnabledbooleanWhether RBAC is enabled on the cluster
cluster.ingress.enabledbooleanWhether ingress is enabled
cluster.ingress.privatebooleanWhether ingress is private (internal-only)
cluster.ingress.ipstring | undefinedPublic IP address of the cluster's ingress
cluster.ingress.ipResourceNamestring | undefinedCloud resource name for the ingress IP
cluster.ingress.ipResourceIdstring | undefinedCloud resource ID for the ingress IP
cluster.ingress.subnets.privatestring[] | undefinedPrivate subnet identifiers
cluster.ingress.subnets.publicstring[] | undefinedPublic subnet identifiers

asset

FieldTypeDescription
asset.namestringName of the asset
asset.versionstringVersion of the asset being deployed
note

asset.name and asset.version are only available in config expressions (values and conditions). They are not available in deploy conditions, which are evaluated before configs are loaded.

secrets

Available in config setting values only. Before expression evaluation, Codiac scans all config values for secrets.* references, fetches each referenced store once, and injects the results into the expression context. Supported store types: Azure Key Vault, AWS Secrets Manager.

FieldTypeDescription
secrets.<storeName>.<key>stringA secret value fetched from the named KVP store at deploy time

Example: @{secrets.myVault.DB_PASS} — fetches the DB_PASS key from the myVault store.

If a referenced store or key cannot be resolved, the deploy fails with a clear error pointing at the unresolved expression. To store @{secrets.*} as a literal rather than evaluating it, escape it as @@{secrets.*}.

For the relationship between secrets.* expressions and the sourcedSettings mechanism, see Expression Examples — Inline secrets.

Functions

Two functions are available inside any expression for resolving host names from the cabinet's ingress configuration.

$hostmap(strategy, domain)

Returns the concrete hostname for a given host naming strategy and domain.

Parameters:

  • strategy — the host naming strategy (e.g., "svc_dot_cab_dot_domain")
  • domain — the base domain (e.g., "example.com")

Returns: The resolved hostname string (e.g., "my-api.dev-cabinet.example.com")

See Ingress and Domain Routing for full details on host naming strategies.

$hostmap_path(strategy, domain)

Same as $hostmap(), but returns the path prefix of the resolved URL instead of the hostname. Used with path-based ingress routing.

Where expressions are evaluated

FeatureContext availableBehavior when expression is falsy
Config setting valueFull context including asset.* and secrets.*The value is the expression result
Config setting conditionFull context including asset.*Setting is omitted from the deployment
Asset deploy conditionContext without asset.* or secrets.*Asset is skipped with a reason message

JSONata basics

JSONata is designed to be readable. A few useful patterns:

GoalExpression
Field accessenvironment.name
String equalityenvironment.name = "prod"
String concatenation"https://" & asset.name & ".example.com"
Boolean checkcluster.ingress.enabled
Negationcluster.ingress.private = false

For the full JSONata reference, see jsonata.org.

What's next