Skip to content

Templates ​

Templates are written {{<source>.<name>.<field>}} (dot notation). They are resolved in a repo's env: and a service's env:, when Pomelo writes the env files and starts the service; every other value (cmd, environments URLs, shared service environment:) is used as written. A token the resolver does not know stays in the output as written, so a typo shows up in the env file instead of becoming an empty value. A | filter after the key is accepted but changes nothing.

Database name templates (databases: and a repo's shared_services: [{ <name>: { db_name: ... } }]) take only the branch tokens; they also accept the older spellings {{branch_safe}} and {{branch|safe}} (and the same for hash and host), but write {{branch.safe}}.

In a cmd, use $PORT (the service's leased port), $BIND_IP or any env var the service gets; a cmd shared service gets $PORT and $BIND_IP too.

Tokens ​

Examples are for branch feat/login of project myproject.

TokenResolves toExampleIn database names
{{shared.<name>.url}}The shared service's connection: user:pass@host:port, or host:port for one with no login (Redis, for example). For a cmd shared service, http://127.0.0.1:<port>. {{shared.<name>}} is the same.postgres:postgres@127.0.0.1:5432-
{{shared.<name>.host}}Always 127.0.0.1: localhost can resolve to ::1, which Docker's published ports miss.127.0.0.1-
{{shared.<name>.port}}The shared service's leased port (plus the instance number when capacity runs several).5432-
{{shared.<name>.user}}The login from db_user (postgres for a Postgres that sets none; empty otherwise).postgres-
{{shared.<name>.pass}}The password from db_password (postgres for a Postgres that sets none; empty otherwise).postgres-
{{shared.<name>.slot}}This workspace's slot on a capacity service, from 0 (a Redis database number, for example); 0 when the service has none.3-
{{slot.<name>}}Same as {{shared.<name>.slot}}.3-
{{db.<name>}}The name of one of the repo's databases: session prefix plus the resolved name template.myproject_feat_login-
{{db.<name>.url}}postgres://user:pass@host:port/<database> through the shared Postgres.postgres://postgres:postgres@127.0.0.1:5432/myproject_feat_login-
{{<repo>.<service>.url}}The service's URL through the dev proxy, http://<service>.<repo>.<branch>.localhost:<proxy port>; or the remote URL when the active environments profile lists <repo>.<service>. <repo> is the alias or the folder name, and {{<repo>.<service>}} is the same. A branch that starts with a ticket key uses just the key in the host: proj-101-login gives server.api.proj-101.localhost.http://server.api.feat-login.localhost:8767-
{{<repo>.<service>.path}}The same-origin dev proxy path, /_pom_dev/<repo>/<service>, for a frontend calling its API without CORS./_pom_dev/api/server-
{{<repo>.<service>.host}}The host part of the service's URL.server.api.feat-login.localhost-
{{<repo>.<service>.port}}The service's leased port (the remote URL's port under a profile).41000-
{{<repo>.<service>.ws}}The service's URL with ws:// (or wss://) for websockets.ws://server.api.feat-login.localhost:8767-
{{secret.<NAME>}}A value from the project's secrets store, read when env is written. Never put a secret in pom.yml.sk_test_123-
{{branch}}The workspace's branch, as is.feat/loginyes
{{branch.safe}}The branch with / turned into _; hyphens are kept: feat/login-form gives feat_login-form.feat_loginyes
{{branch.host}}The branch as a DNS label: lowercase, other characters turned into -, at most 63 bytes (a hash suffix keeps long names apart).feat-loginyes
{{branch.hash}}The first 8 hex digits of the branch's SHA-1.5d5c6df1yes
{{bind_ip}}Always 127.0.0.1.127.0.0.1-

Removed colon forms ​

Loading a config that still has one of these fails. config_normalize (or pom config normalize) rewrites the ones that have a replacement.

RemovedWrite instead
{{conn:<name>}}{{shared.<name>.url}}
{{host:<name>}}, {{port:<name>}}{{shared.<name>.host}}, {{shared.<name>.port}}
{{user:<name>}}, {{pass:<name>}}{{shared.<name>.user}}, {{shared.<name>.pass}}
{{db:<name>}}{{db.<name>}}
{{slot:<name>}}{{shared.<name>.slot}}
{{var:<NAME>}}, {{url:...}}, {{ws:...}}No replacement: use a service ref such as {{<repo>.<service>.url}}.