#408·portless

Inject Portless URLs into environment variables

Author: pedroapfilhoCreated Sep 3, 2026Updated Sep 3, 2026

Problem

I use portless across several repos with multiple apps and worktrees. Those apps often need each other's portless URLs through environment variables such as APP_URL, API_URL, or AUTH_URL.

Right now, each project contains a helper that runs portless get <name> and copies the result into process.env. It works, but it couples application configuration to the portless CLI and duplicates the same code across our repos.

Desired behavior

When portless launches a development process, I'd like it to resolve a declared mapping between environment variables and Portless names:

APP_URL -> web
API_URL -> api
AUTH_URL -> auth

The child process would receive the worktree-aware URLs without application code calling portless get.

This could be configured declaratively, or through a command such as:

bash
portless env APP_URL=web API_URL=api AUTH_URL=auth -- pnpm dev

I'm not attached to that interface. The outcome I'm after is:

  • No portless-specific subprocess calls in application source
  • One declarative mapping per project
  • Correct URLs for the current worktree
  • Support for one app referring to other Portless apps

Does portless already have a preferred way to handle this, or would it fit the project's scope?