Expressions
Values in the project file and the local file can hold ${{ ... }} expressions, which devlanes evaluates for each lane. Environment and expressions explains where their values go.
Syntax
Section titled “Syntax”| Form | Meaning |
|---|---|
${{ expression }} | An expression, in the expression language of MiniJinja templates. |
text ${{ a }} text | Text with expressions in it. The result is text. |
${{ '${{' }} | A literal ${{. |
${{ a | default('x') }} | A filter. Filters and tests are MiniJinja’s built-in ones, such as default, upper, replace, join, int, tojson and is defined. |
${{ ‘a’ if lane. | A condition. |
A value that is one whole expression keeps its type, so autostart: ${{ lane.index == 0 }} is a boolean. Text with an expression in it is text. A name that does not exist is an error; default gives it a value.
Namespaces
Section titled “Namespaces”| Name | Value |
|---|---|
project. | project from the project file. |
project. | The path of the primary worktree. |
lane. | The lane number: 0, 1, 2 and so on. |
lane. | main for lane 0, lane<N> for lane N. |
lane. | The branch with each / replaced by -, such as feat-checkout. |
lane. | The path of the lane’s worktree. |
lane. | The lane data folder. |
lane. | The lane domain: myapp.localhost in lane 0, myapp1.localhost in lane 1. |
lane. | The first port of the lane’s port block. |
lane. | An entry of lanes.vars. |
self. | The name of the service the value belongs to. |
self. | Its port. |
self. | Its named port <name>. |
self. | http://127.0.0.1:<port>. |
self. | https:// and its first hostname. Undefined for a service without hostnames. |
self. | Its hostnames. |
services. | The same fields for another service of the lane. |
lanes. | The same fields for a service of lane 0. |
projects. | The same fields for a service of another running project. |
infra. | The host port of a container’s first published port. |
infra. | The host port published for a container port of a Compose service. |
infra. | The host port of a named port of an infra.containers entry. |
env. | A variable from the shell that ran the devlanes command, else from the lane’s .env file. |
replica., replica.count | The replica’s number, from 1, and the service’s replicas. |
In a task, self holds only name. infra.containers, infra.compose, infra.hosts, infra.env and infra.external read only project, lane, infra and env.
A name with a dash is written services['crm-api'] or services.crm_api.
Functions
Section titled “Functions”| Function | Result |
|---|---|
domain(name) | The domain of name in this lane, by the rule of lane.domain: pages.localhost in lane 0, pages2.localhost in lane 2. |