Appearance
Config (ctx.config)
ctx.config.get reads one entry from the tenant's current configuration. Use it for values that operators change without editing scripts: thresholds, limits, default regions.
text
ctx.config.get(key: string, default: any?) -> (ok, value)- A key that is not set is a success and returns
default(ornilwithout one). - An empty key, or a failure reading the configuration, raises an error.
lua
local ok, retries = ctx.config.get("integrations.retryLimit", 3)
if not ok then error(retries) end
local okRegion, region = ctx.config.get("shipping.defaultRegion", "unset")
if not okRegion then error(region) end
return { retries = retries, region = region }Pass the fallback as the second argument rather than writing value or fallback: a stored false survives the built-in default but would be replaced by or.
Availability
ctx.config exists in every role except integrations and product-template resolvers. An integration reads its install-time settings with ctx.integration.getConfig(), which returns (ok, config) with the whole configuration table.