A deployed app's settings #
On this page
Turn Zero Cloud supplies runtime settings as environment variables, available through process.env. Local runs use the settings described in Run your app on your computer.
A server listens on PORT; a function listens on no port. Both build every absolute link, redirect, and file address they hand out from APP_PUBLIC_HOST, never from the request's Host (Settings and environment variables a deployed copy receives).
Settings and environment variables a deployed copy receives #
Each deploy, promote, platform redeploy, and restart_application supplies these settings to the new running copy. See Database environment variables for the settings your database supplies.
See Database environment variables for the two PostgreSQL URLs, the connection limit, and when each applies.
| Setting | What it contains | When it is present |
|---|---|---|
PORT |
8080, the port your server listens on. |
On a server environment. Functions receive no PORT. |
APP_PUBLIC_HOST |
The environment's public hostname, never the request's Host. It contains neither a scheme nor a path, such as my-app-x1y2z3.ai.host, so an address you hand out is https:// followed by it. Build every absolute link, redirect, and file address you hand out from it, because the request's Host header names the platform's internal address for the environment. After a rename, the rename's restart writes the new hostname; where the restart is refused, the copy keeps the old one until the next deploy or promote. On production, once a domain of your own serves, it is that domain until you detach it, and the platform restarts the copy at each change. Where that restart is refused or fails, the copy keeps the old value until production's next deploy, promote, or restart_application (Attach your own domain). |
Always. |
APP_ENVIRONMENT |
development or production. |
Always. |
APP_VERSION |
The version applied, the integer read_status and list_versions show. A health path that returns it shows which version responds. |
Always. |
TURNZERO_CLOUD_API |
The platform's origin, for sign-in, account reads, the verification route, and management calls. Its value is scheme and host with no path or trailing slash, such as https://dev.turnzero.ai, and you append your call's path. Calls to it, and to TURNZERO_CLOUD_GATEWAY_URL, need no entry in the manifest's egress (Platform endpoints). |
Always. |
TURNZERO_CLOUD_APPLICATION |
The application's identifier, the value create_application returned. |
Always. |
TURNZERO_CLOUD_APP_TOKEN |
The environment's platform credential, the bearer for storage, egress, and logging calls. It is kept secret. | Always. |
TURNZERO_CLOUD_GATEWAY_URL |
The origin for storage, egress, and logging calls. Without it, send those calls to TURNZERO_CLOUD_API. |
Where the platform configures a separate origin. |
TURNZERO_CLOUD_REALM_KEYS |
The end-user realm's public key set, as one JSON string, its keys empty before the realm's first sign-in. |
Where the environment has a realm. |
HTTPS_PROXY, HTTP_PROXY, NO_PROXY |
The proxy settings, in upper and lower case, for a client that needs an explicit proxy agent. The runtime harness, the platform's code that runs in your process, sets them as the process starts, so read them at run time. | On a server environment whose outbound calls go through the platform's proxy. The platform does not supply them to functions. |
HOME |
/tmp. |
On a server environment that runs as a pod. The platform does not supply it to functions. |
Turn Zero Cloud supplies a deployed copy with both TURNZERO_CLOUD_API and TURNZERO_CLOUD_GATEWAY_URL today. Send storage, egress and logging calls to TURNZERO_CLOUD_GATEWAY_URL, and sign-in, account reads, verification and management calls to TURNZERO_CLOUD_API.
The application's audience kind changes none of these settings: a public, invited, or workforce application receives the same list. TURNZERO_CLOUD_REALM_KEYS is set only if the environment has a realm. Declaring the accounts service in the manifest creates that realm. An invited or workforce application that has never declared accounts therefore receives no realm keys.
No setting is named NODE_ENV: neither the image nor the platform sets it, and the manifest cannot bind a name under NODE_. An application whose framework reads it sets the mode it wants in its own code.
The copy receives its own identifier as TURNZERO_CLOUD_APPLICATION, so code that binds a storage area to the application reads it there, not from a copy in the code. No setting contains an issue-tracking space or its token: a backend reaches its application's space through the egress gateway, as the Issue Tracking package says. No setting is named TURNZERO_CLOUD_ORIGIN, which only the turnzero command reads. Your code reads the platform's origin from TURNZERO_CLOUD_API.
Database environment variables #
A server environment with a database receives both connection strings. For functions, use APP_DATABASE_URL to connect.
| Setting | What it contains | When it is present |
|---|---|---|
APP_DATABASE_URL |
Secret database connection string. A server on the unlimited plan, or using a dedicated database server, gets the direct port at every act. Other servers use the pooled port on deploy. A promotion, rollback, restart or platform redeploy reuses the database port saved with the version. A function environment receives APP_DATABASE_URL alone. It uses shared pooler port 6432 or dedicated direct port 5432. |
Where the environment has a database. |
APP_DATABASE_DIRECT_URL |
Secret database connection string on the direct port, for work needing one server session. | On a server environment with a database. |
APP_DATABASE_CONNECTION_LIMIT |
The maximum each process should set for its client pool, from its plan or size on a shared server or its dedicated database size. The database role accepts twice that number. | On a server environment with a database and a configured connection limit. |
Changes to a running copy's settings #
A running copy keeps the values it started with.
After platform staff change the size's connection-limit value, each environment receives the new APP_DATABASE_CONNECTION_LIMIT on its next deploy, promote or restart_application. A running copy keeps the value it started with.
If an environment has a database and its size's connection limit is unset, the platform refuses restart_application with plan_quantity_unset. It also refuses restarts caused by a rename or a change of domain, credential or size. A redeploy started by platform maintenance goes ahead instead: it leaves the setting out and writes a warning to the log. The Database package's pool then uses one connection (The connection limit).
The manifest's settings member adds your own settings to the table's, in two forms. A binding names a setting and the stored name whose value it receives, kept secret like the platform credential. A plain setting names a setting and its value, {"value": "<text>"}, which the copy receives as a plain setting, the same in every environment. Your code reads either form from process.env. A value you store with store_secret is a setting only where the manifest binds it.
A platform redeploy re-applies the bound and plain settings the running copy started with. It leaves out a binding if the stored secret has been removed. It also leaves out a setting if an upstream's sdk_settings now supplies the same setting name. For either omission, the platform writes a warning to your log naming the setting, never its value.
Where a bound name exists and the store does not respond, the redeploy ends failed bound_setting_unreadable, and the running copy keeps running. Bind a stored value to a setting shows a binding, and Set a value that is not secret a plain setting.
A declared upstream's sdk_settings add one or two more, under the names you declared. The base-URL setting contains the gateway's address for that upstream. The key setting contains an egress key, kept secret: a credential the platform creates for that upstream and this copy alone. Each deploy, promote, and platform redeploy creates fresh egress keys from the upstream declarations existing then. The upstream's own key never enters the copy. An unchanged SDK shows how an SDK uses them.
On a server, the platform sets other settings for the runtime harness, and your code never reads them: HOSTING_WINDOW_REQUEST_SECONDS, HOSTING_WINDOW_SCHEDULE_SECONDS, HOSTING_WINDOW_GRACE_SECONDS, HOSTING_SCHEDULE_PATHS, EGRESS_PROXY, EGRESS_PLATFORM_ENDPOINTS, NODE_OPTIONS, npm_config_update_notifier, and npm_config_script_shell. The router mark's setting, ROUTER_MARK_SECRET, is the platform's too. Where the environment uses an egress proxy, EGRESS_PROXY contains its origin and EGRESS_PLATFORM_ENDPOINTS lists the platform hostnames reached directly, separated by commas.
A function receives no setting under HOSTING_ or ROUTER_. Where its cell has an egress proxy, three settings together serve its global fetch. EGRESS_PROXY contains the proxy's origin. EGRESS_PLATFORM_ENDPOINTS lists the platform endpoints reached directly, each as a host and port, separated by commas. EGRESS_DECLARED_HOSTS lists the manifest's declared outgoing hosts, in lower case with surrounding space and one final dot removed, each listed once and separated by commas. Its value is empty where no host is declared. Application code uses fetch, never these settings. Where the cell has no egress proxy, none of those three settings is supplied.
The runtime harness removes ROUTER_MARK_SECRET from the environment before your request listener runs (Node.js Runtime). Where the harness cannot save the mark to its own file, the setting stays, and one line in your log names it.
What the application runs under #
This section describes a server application's container. Functions run in a shared pool; Deploy functions describes their runtime limits.
The running image is Docker Hub's node:24-bookworm-slim, pinned by digest: Node.js 24 and its npm, and a minimal Debian 12 on Linux x64 with glibc. It contains no compiler, git, Python, or curl.
The container starts with tini -g, a small program that starts the child process and forwards signals to its process group. The platform sets npm_config_script_shell to /harness/start_shell, which starts /bin/sh (dash) with SIGTERM ignored by the shell. That shell waits for the script's commands. Node.js Runtime explains how to write a start script that stops cleanly.
On an environment that runs as a pod, the process runs as user ID (uid) 1000. On its own container it runs as root, because the image names no user. Either way the application's files under /app belong to uid 1000. Where each environment runs says which environment runs as a pod: every development environment, and production on Shared 0.5 GB, where shared compute has room.
What the code writes to the disk, /tmp and the HOME folder included, is lost whenever the copy is replaced or stops (Running copy). A file the application needs again goes in a storage area or a database.
It runs JavaScript, code compiled to JavaScript or WebAssembly, and native modules. Ship native modules in your app or any workspace member prebuilt for Linux x64 with glibc. The deploy refuses those modules if the build would have to compile them. A dependency's native module can build during installation on node:24-bookworm. All native modules can use only the slim runtime image's shared libraries. The build loads each one and fails on one that does not load (the load check). A module opening a library only at first use fails at that use.
The copy also runs under the platform's network controls and request limits, which Egress firewall and request limits explains. An environment whose warm floor is 0 stops after a spell with no requests, and the next request waits while a copy starts.
Read the memory limit #
From your deployed Node.js server, call process.constrainedMemory() for the copy's memory limit in bytes. Call process.availableMemory() for the bytes still available at that moment. Both calls worked on a pod and a container app in the November 25, 2026 development trial. See Node.js process documentation.
In that trial, os.totalmem() and os.freemem() measured the host. The cgroup files differed between a pod and a container app, so use the Node.js process calls to read memory. For CPU limits, see the platform's CPU and memory figures.
Child processes and headless browsers #
A server application can start other programs as child processes. They can use the running image's shared libraries and any libraries they bring with them. The slim base image includes no browser, font package, or display package. Supply the browser and any libraries it needs that the image lacks. The image build's load check covers .node files alone. A program missing a shared library can fail at startup even after a successful deploy.
The small-image build from @sparticuz/chromium needs libnss3, libnspr4 and libexpat1, which the server image lacks, and standard builds such as Chrome for Testing, which Puppeteer downloads, need additional desktop libraries the image also lacks.
A child process shares the application's memory limit. In the development trial, a child exceeding that limit stopped the whole copy on the pod. In the container app, the child stopped and the server kept responding.
On a pod the child runs as uid 1000 with privilege escalation disabled and all capabilities dropped. By default, the pod's /tmp volume is limited to 512 MiB and its ephemeral storage to 2 GiB. Files unpacked in /tmp are lost when the copy stops or is replaced.
Development has 0.5 GiB of memory by default. The owner can match production’s size to give development 1 GiB on Shared 1 GB. For a development pod, matching lowers the CPU limit from 1 vCPU to 0.5 vCPU on Shared 1 GB or 0.25 vCPU on Shared 0.5 GB. On Shared 0.5 GB, a development container keeps its default CPU and memory limits. Development retains its placement type. To test the application and browser together on Shared 1 GB production compute, use a separate production test app at that size. See Check development before promoting.
The runtime harness leaves child processes' outbound connections out of its records. To reach an external service, the program must use the platform's egress proxy. The HTTPS_PROXY URL contains your application's platform credential, so keep it out of logs. A program that only renders the content you give it can work without external requests.
Related #
- Deploy from your computer deploys the copy that receives these settings.
- Run your app on your computer lists the settings a local run reads from its environment file.
- Bind a stored value to a setting binds a stored value to a setting of your own.
- Call an external API with an API key shows how an unchanged SDK reads an upstream's settings.
- Egress firewall and request limits explains the network controls the copy runs under, and What the router sets on each request the request's headers.
- The Node.js Runtime package describes the runtime harness that reads the platform's own settings.
- The Database, Egress, Schedule, and Storage packages say which of these settings their clients read.
- Native modules says what a native module needs to load on the running image.