Skip to content
homeport

Docs · Configure

Environments and variables

Every team has a production environment and can add its own, like staging. Set an app’s variables on its environment’s Variables tab, and variables for the whole team on Global variables. Every value is encrypted when it is saved. A secret’s value is never shown again; a variable’s value is shown, so you can read and edit it.

Your team’s environments

production is always there. Add others, such as staging or qa, on the team’s Environments page, or right where you add an environment to an app. An app can then have one of each, every one with its own address, variables, database and storage.

Environments per plan
PlanEnvironments, production included
Free1
Starter2
Growth5
Business20
  • Names are lowercase letters, digits and dashes, up to 20 characters. A staging environment answers at name-staging.homeport.run.
  • Moving to a plan with fewer keeps the environments you have. It only stops new ones being added.
  • An environment can be deleted once nothing is in it: no app, no database or storage attached, and no domain. The page links to whatever is in the way. Global values set for it alone go with it.

Setting an app’s variables

  • When you create an app: open Environment variables, then add them One by one or Paste .env. The paste box takes NAME=value or NAME: value, one a line, and skips comments and export. The app’s first release starts with them.
  • Afterwards: on the environment’s Variables tab, enter a name and value and choose Add. Setting a name that exists replaces its value.
Paste .env
# comments are skipped
DATABASE_URL=postgres://user:[email protected]:5432/app
export APP_KEY=base64:…
MAIL_FROM: [email protected]

Each environment has its own variables: production and staging do not share them. Static sites have none, since nothing runs.

Global variables

A global variable is set once for the team, on the Global variables page, and every app gets it. Give it a value for all environments, a value for one environment, or both: MAIL_FROM for all, and a different PAYMENTS_KEY in production and staging, say.

When the same name is set in more than one place, the most specific wins:

  1. A global value for all environments.
  2. A global value for this environment, over the one for all.
  3. The app’s own variable on its Variables tab, over both.
  4. A variable set by a database or storage, over everything. These are marked as managed and cannot be changed by hand.

An environment’s Variables tab lists the global variables it inherits, marked global, and marks its own that override one. A global value cannot take a name a database or bucket sets in an environment it reaches. Changing a global variable restarts only the apps it changes.

When a change takes effect

At once. Saving or removing a variable restarts the running app with the new set; nothing is rebuilt. Every deploy starts with the current values. A change that leaves an app’s values as they were does not restart it.

Names and values

  • Names are letters, digits and _, and do not start with a digit, like DATABASE_URL.
  • A value cannot contain a newline, a carriage return or a NUL. To pass a multi-line value such as a PEM key, encode it (as base64, say) and decode it in your app.
  • One invalid variable refuses the whole change, so nothing is half-saved.

How they are stored

Each environment has its own encryption key, and so does the team for its global variables. Each value, secret or not, is sealed with AES-256-GCM as it is saved. A variable’s value is shown on the dashboard. A secret’s value is never shown again, and a new value is a secret unless you choose Variable. Files are always secrets. To see a secret again, look where you keep the original: homeport cannot show it to you either.

Variables homeport sets

Variables your app is given
NameValue
PORTThe port your app must listen on. Assigned per app, so never hard-code one.
HOST0.0.0.0: the address to listen on.
STATE_DIRA writable folder for scratch files. It does not last past a move, so keep data in a database or storage.
NODE_ENVproduction
CDN_PURGE_URLThe private address that purges your pages from the edge’s cache: see Purge a page. Not set on an app without a domain, or one served under a path of another app’s domain.

PORT, HOST, HOSTNAME and PATH are set by homeport and cannot be overridden. Values you set for system names such as HOME, USER, SHELL, LANG or TERM are not passed to your app.

In homeport.yaml’s run, only $PORT and $HOST can be used. Read every other variable from the environment in your code.

Defaults for your framework

Some framework defaults assume one machine with a disk that lasts. homeport runs copies of your app that share nothing, so for these it adds a value of its own to the environment’s variables at each build, only where you have none. Each is listed on the Variables tab as Set by homeport. Set your own value under the same name and homeport leaves it alone.

Defaults homeport sets
NameValueWhat it does
LOG_CHANNELstderrLaravel 12 and later: logs go to the app’s output, so homeport’s logs show them. Laravel’s own default writes storage/logs/laravel.log inside a copy, which nobody sees and which is lost with the copy.
APP_URLhttps:// and your primary domainLaravel: the address its links, redirects and emails use. With no domain of your own it’s the environment’s homeport.run address; a preview gets its own. When your primary domain changes, homeport changes it too, unless you set your own value, and the running app restarts with the new one. No deploy is needed.

Both are given to the running app. For JavaScript frameworks, homeport makes keys, so that every copy and every build agree:

Keys homeport makes
NameForSeen byWhat it does
NEXT_SERVER_ACTIONS_ENCRYPTION_KEYNext.jsThe build and the appThe same key on every build keeps server action forms in open tabs working across deploys.
NEXT_DEPLOYMENT_IDNext.jsThe buildTells deploys apart, so a page from an older deploy reloads instead of failing. Made for each deploy, never stored.
RSC_ACTION_ENCRYPTION_KEYAnything using @vitejs/plugin-rscThe build and the appThe same key on every build keeps server action forms working across deploys. rsc-kit reads it; another framework needs rsc({ defineEncryptionKey: "process.env.RSC_ACTION_ENCRYPTION_KEY" }).
RSC_SIGNING_SECRETrsc-kitThe appSigns what a page watches for changes, the same on every copy.
RSC_HOST_CALL_SECRETrsc-kit beside a backendThe appProves the renderer’s calls to the backend, and the backend’s to it.
ASTRO_KEYAstro with server output or an adapterThe buildServer islands: the same key on every build keeps pages cached from one build working with the next.
  • A key is 32 random bytes, made once for each environment and kept, and it is a secret. A preview gets its own.
  • On the Variables tab, a key homeport made can be regenerated. RSC_SIGNING_SECRET and RSC_HOST_CALL_SECRET then keep the value before it in RSC_SIGNING_SECRET_PREVIOUS and RSC_HOST_CALL_SECRET_PREVIOUS, so what was signed with it still checks.
  • The Next.js and RSC_ACTION_ENCRYPTION_KEY rows keep who sees them, even for a value of your own under the name: the framework breaks otherwise.

Laravel 12 and later keep sessions, the cache and the queue in the database already, so homeport leaves them as they are. php artisan down affects only the copy it runs in. To take down every copy, set APP_MAINTENANCE_DRIVER=cache (each request then checks the cache).