Variables are the configurable parameters that customize your templates. This page explains variable types, sections, dependencies, and how to work with them effectively.
Variables are parameters that control template generation. They can be:
Example:
service_name: my-app # String
container_port: 8080 # Integer
traefik_enabled: true # Boolean
restart_policy: unless-stopped # Enum (selection from options)
str)Text values with optional constraints:
service_name:
type: str
description: Service name
default: my-service
Usage:
int)Whole numbers:
container_port:
type: int
description: Container port
default: 8080
Usage:
float)Decimal numbers:
cpu_limit:
type: float
description: CPU limit in cores
default: 1.5
Usage:
bool)True/false values:
traefik_enabled:
type: bool
description: Enable Traefik integration
default: false
Usage:
enum)Selection from predefined options:
restart_policy:
type: enum
description: Container restart policy
options: [unless-stopped, always, on-failure, no]
default: unless-stopped
Usage:
email)Email addresses with validation:
admin_email:
type: email
description: Administrator email
default: admin@example.com
Validation:
url)Full URLs with scheme validation:
api_endpoint:
type: url
description: API endpoint URL
default: https://api.example.com
Validation:
hostname)Domain names or hostnames:
traefik_host:
type: hostname
description: Service hostname
default: app.example.com
Validation:
Every variable can have these properties:
variable_name:
type: str # Variable type (required)
description: Description # Help text
default: value # Default value
prompt: Custom prompt text # Override description in prompts
extra: Additional help # Extended help text
sensitive: false # Mask input (for passwords)
autogenerated: false # Auto-generate if empty
needs: condition # Dependency constraint
Mask input for passwords and secrets:
admin_password:
type: str
description: Administrator password
sensitive: true
Behavior:
********)*** in outputAutomatically generate values if not provided:
secret_key:
type: str
description: Secret key
autogenerated: true
Behavior:
*auto placeholder in promptsOverride the description text in interactive prompts:
service_name:
description: Service name (used in docker-compose)
prompt: Enter service name
Variables are organized into sections that group related configuration:
spec:
general: # Required by default
title: General Settings
vars:
service_name: {...}
container_port: {...}
networking: # Optional section
title: Network Configuration
toggle: networking_enabled
vars:
network_name: {...}
network_mode: {...}
Sections marked as required: true must be configured:
general:
title: General
required: true
vars:
service_name: {...}
Behavior:
general section is implicitly requiredSections with a toggle variable:
traefik:
title: Traefik
toggle: traefik_enabled
vars:
traefik_host: {...}
traefik_network: {...}
Behavior:
Sections can depend on other sections:
traefik_tls:
title: Traefik TLS/SSL
needs: traefik
vars:
traefik_tls_enabled: {...}
Behavior:
needs: [traefik, networking]Variables can depend on other variables using needs constraints:
Variable only visible when condition is met:
network_name:
type: str
description: Network name
needs: network_mode=bridge
Behavior:
network_mode equals bridgeVariable visible for multiple values:
network_name:
type: str
description: Network name
needs: network_mode=bridge,macvlan
Behavior:
network_mode is bridge OR macvlannetwork_mode is hostVariable requires multiple conditions:
traefik_tls_certresolver:
type: str
description: Certificate resolver
needs: traefik_enabled=true;network_mode=bridge
Behavior:
;) separates conditions,) within a condition is ORVariables are resolved in priority order (lowest to highest):
~/.config/boilerplates/config.yaml--var flagsExample:
# Module default: restart_policy=unless-stopped
# Template override: restart_policy=always
# User config: restart_policy=on-failure
# CLI override: --var restart_policy=no
# Result: restart_policy=no (CLI wins)
Save frequently used values:
# Set a default
boilerplates compose defaults set container_timezone "America/New_York"
# View all defaults
boilerplates compose defaults list
# Remove a default
boilerplates compose defaults rm container_timezone
# Clear all defaults
boilerplates compose defaults clear
When generating templates interactively, the CLI prompts for each variable:
Service name: |my-app|
Enable Traefik? (y/n) [n]:
y or yes for truen or no for falseRestart policy:
1) unless-stopped (default)
2) always
3) on-failure
4) no
Select [1]:
Admin password: ********
Skip prompts entirely using --no-interactive:
boilerplates compose generate nginx ./output \
--var service_name=my-nginx \
--var container_port=8080 \
--no-interactive
Behavior:
Variables are validated during prompts:
Example:
Container port: abc
Error: Must be a valid integer
Container port:
Templates are validated when loaded:
Templates inherit ALL variables from their module schema. You only override what's different:
Module defines:
general:
vars:
service_name:
type: str
container_port:
type: int
default: 8080
Template overrides:
spec:
general:
vars:
service_name:
default: nginx # Only override default
# container_port inherits 8080
Variables with needs constraints are dynamically shown/hidden based on other values:
# If user selects network_mode=host
# → Network name prompt is skipped (needs: network_mode=bridge)
# If user selects network_mode=bridge
# → Network name prompt is shown
The CLI automatically:
traefik_* for Traefik variablesnetwork_* for networking variablesports_* for port configurationGood:
traefik_host:
description: Service subdomain or full hostname (e.g., 'app' or 'app.example.com')
Bad:
traefik_host:
description: Host
Use sections to organize configuration:
spec:
general: # Core configuration
network: # Network settings
traefik: # Reverse proxy
traefik_tls: # TLS/SSL configuration