Skip to content

Tenant Variables

Configure tenant-specific values for deployments.

Mantis supports two types of tenant variables:

TypeDescriptionScope
Template VariablesValues for solution-defined templatesPer solution
Common VariablesKey-value pairs shared across solutionsGlobal to tenant

Solutions define variable templates that tenants must fill in:

PropertyDescription
NameVariable identifier (e.g., database_host)
LabelHuman-readable name
Help TextUsage instructions
Control TypeInput type for UI
Default ValuePre-filled value if not set
RequiredMust be set before deployment
TypeDescriptionUse Case
TextSingle-line inputURLs, hostnames
MultilineMulti-line text areaConfiguration blocks
SelectDropdown selectionPredefined options
CheckboxBoolean toggleFeature flags
SensitivePassword input (encrypted)API keys, secrets
┌─────────────────────────────────────────────────────────────┐
│ Tenant Variables: Acme Corp │
├─────────────────────────────────────────────────────────────┤
│ │
│ Solution: customer-portal │
│ Environment: [All ▼] │
│ │
│ ───────────────────────────────────────────────────────── │
│ │
│ database_host * │
│ Database server hostname │
│ [db.acme.com ] │
│ │
│ api_key * │
│ External API key (encrypted) │
│ [•••••••••••••••••• ] │
│ │
│ log_level │
│ Application log verbosity │
│ [info ▼] │
│ debug │
│ info │
│ warn │
│ error │
│ │
│ feature_new_checkout │
│ Enable new checkout experience │
│ [✓] │
│ │
│ [Cancel] [Save] │
│ │
└─────────────────────────────────────────────────────────────┘
* Required field

Variables can be set globally or per environment:

┌─────────────────────────────────────────────────────────────┐
│ Variable: database_host │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌───────────────┬────────────────────────────────────────┐│
│ │ Environment │ Value ││
│ ├───────────────┼────────────────────────────────────────┤│
│ │ (Default) │ db.acme.com ││
│ │ Development │ dev-db.acme.local ││
│ │ Staging │ staging-db.acme.com ││
│ │ Production │ prod-db.acme.com ││
│ └───────────────┴────────────────────────────────────────┘│
│ │
└─────────────────────────────────────────────────────────────┘

Key-value pairs available across all solutions:

Tenant: Acme Corp
Common Variables:
├── company_name = "Acme Corporation"
├── support_email = "support@acme.com"
├── region_code = "us-east-1"
└── ssl_enabled = "true"
┌─────────────────────────────────────────────────────────────┐
│ Common Variables: Acme Corp │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌────────────────┬──────────────────┬───────┬───────────┐ │
│ │ Key │ Value │ Scope │ Actions │ │
│ ├────────────────┼──────────────────┼───────┼───────────┤ │
│ │ company_name │ Acme Corporation │ All │ [Edit][×] │ │
│ │ support_email │ support@acme.com │ All │ [Edit][×] │ │
│ │ region_code │ us-east-1 │ Prod │ [Edit][×] │ │
│ └────────────────┴──────────────────┴───────┴───────────┘ │
│ │
│ [+ Add Variable] │
│ │
└─────────────────────────────────────────────────────────────┘

Tenant variables are managed in Lens or through the /api/v1/tenants/<tenant-id>/variables REST endpoints (there is no mantisctl variable subcommand). To set a tenant-scoped variable:

Terminal window
# Set a tenant variable (variable_type is "common" or "template")
curl -X POST "$MANTIS_URL/api/v1/tenants/<tenant-id>/variables" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"template_id_or_key": "company_name", "value": "Acme Corporation", "variable_type": "common", "is_encrypted": false}'
# List a tenant's variables
curl "$MANTIS_URL/api/v1/tenants/<tenant-id>/variables" \
-H "Authorization: Bearer $TOKEN"

/api/v1/variable-sets is a separate feature for reusable library variable sets linked to solutions — not tenant variables.

Variables are resolved in this order (later overrides earlier):

Variable: database_host
Deployment: customer-portal to Acme Corp (Production)
Resolution:
1. Solution default: "localhost"
2. Common (no env): "db.acme.com"
3. Common (Production): (not set)
4. Template (no env): "db.acme.com"
5. Template (Production):"prod-db.acme.com"
Final value: "prod-db.acme.com"

Variables marked as sensitive are encrypted at rest:

┌─────────────────────────────────────────────────────────────┐
│ Sensitive Variable │
├─────────────────────────────────────────────────────────────┤
│ │
│ api_key │
│ [•••••••••••••••••• ] │
│ │
│ ┌───────────────────────────────────────────────────────┐ │
│ │ 🔒 This value is encrypted at rest. │ │
│ │ Write-only — it cannot be retrieved after saving. │ │
│ └───────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘

Mark a variable sensitive by setting its variable_type to sensitive. The stored value is encrypted at rest and masked in responses:

Terminal window
curl -X POST "$MANTIS_URL/api/v1/variable-sets/<set-id>/variables" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "api_key",
"value": "secret-key-123",
"variable_type": "sensitive"
}'
PracticeDescription
Use sensitive flagAlways encrypt secrets
Rotate regularlyUpdate sensitive values periodically
Audit accessReview who can view sensitive variables
Avoid in scriptsDon’t hardcode sensitive values

Variables are available in scripts:

deploy.sh
#!/bin/bash
echo "Deploying to ${database_host}"
echo "API Key configured: ${api_key:+yes}"
# Use variables in configuration
cat > /app/config.json << EOF
{
"database": "${database_host}",
"logLevel": "${log_level:-info}",
"features": {
"newCheckout": ${feature_new_checkout:-false}
}
}
EOF
SyntaxDescriptionExample
${var}Simple substitution${database_host}
${var:-default}Default if unset${log_level:-info}
${var:+alt}Alternate if set${api_key:+configured}

There is no single bulk-import command. To load many variables, iterate over a file and POST each one to the variable set:

Terminal window
# variables.json
{
"database_host": "db.acme.com",
"api_key": "secret-key",
"log_level": "info"
}
# Import each entry into a variable set
jq -r 'to_entries[] | "\(.key)\t\(.value)"' variables.json | \
while IFS=$'\t' read -r key value; do
curl -s -X POST "$MANTIS_URL/api/v1/variable-sets/<set-id>/variables" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"name\": \"$key\", \"value\": \"$value\"}"
done

List a variable set’s variables and reshape the JSON for backup or migration (sensitive values are masked in the response):

Terminal window
curl -s "$MANTIS_URL/api/v1/variable-sets/<set-id>/variables" \
-H "Authorization: Bearer $TOKEN" > variables-backup.json

Per-variable change history is not tracked in a dedicated view. To see who changed a variable and when, use the audit log (/api/v1/audit), which records variable create, update, and delete events.

Deployments are blocked if required variables are missing:

┌─────────────────────────────────────────────────────────────┐
│ Deployment Blocked │
├─────────────────────────────────────────────────────────────┤
│ │
│ Cannot deploy: Missing required variables │
│ │
│ ✗ database_host - Not set for Production │
│ ✗ api_key - Not set │
│ │
│ Set these variables before deploying. │
│ │
│ [Set Variables] [Cancel] │
│ │
└─────────────────────────────────────────────────────────────┘

View resolved variables before deployment:

┌─────────────────────────────────────────────────────────────┐
│ Resolved Variables │
├─────────────────────────────────────────────────────────────┤
│ │
│ Deployment: customer-portal v1.4.0 to Production │
│ Tenant: Acme Corp │
│ │
│ ┌────────────────┬────────────────────┬───────────────┐ │
│ │ Variable │ Value │ Source │ │
│ ├────────────────┼────────────────────┼───────────────┤ │
│ │ database_host │ prod-db.acme.com │ Template/Prod │ │
│ │ api_key │ •••••• │ Template │ │
│ │ log_level │ warn │ Template/Prod │ │
│ │ company_name │ Acme Corporation │ Common │ │
│ └────────────────┴────────────────────┴───────────────┘ │
│ │
│ [Back] [Deploy] │
│ │
└─────────────────────────────────────────────────────────────┘
CategoryVariables
Connectiondatabase_host, redis_url, api_endpoint
Credentialsapi_key, db_password, ssl_cert
Configurationlog_level, timeout, max_retries
Feature Flagsfeature_x, enable_beta

Set sensible defaults in templates:

VariableGood DefaultWhy
log_levelinfoSafe for production
timeout_seconds30Reasonable wait
max_retries3Standard retry count
api_key(none)Must be explicitly set

Add help text to templates:

Variable: database_host
Label: Database Host
Help Text: "PostgreSQL server hostname (e.g., db.company.com)"

Always verify variables before production deployments:

  • Check all required variables are set
  • Verify environment-specific overrides
  • Confirm sensitive values are current

Cause: Wrong variable name or scope

Solution:

  1. Check exact variable name (case-sensitive)
  2. Verify environment scope matches deployment
  3. Check resolution order

Cause: Encryption key issue or not set

Solution:

  1. Re-set the sensitive variable
  2. Check encryption configuration
  3. Contact administrator if persists

Cause: Invalid variable reference in script

Solution:

  1. Check syntax (${var} not $var)
  2. Verify variable exists
  3. Add default value: ${var:-default}