Pular para o conteúdo

Environment variables

Este conteúdo não está disponível em sua língua ainda.

Buntime has three configuration scopes, each with its own mechanism:

ScopeMechanismWhat it controls
Runtime coreEnvironment variablesPort, pool size, directories, log level, auth
Pluginsmanifest.yaml per plugin (config/env)Plugin behavior; surfaced as Bun.env via Helm/ConfigMap
Workers / appsmanifest.yaml + .env in the app dirPer-app Bun.env (sensitive keys filtered out)
VariableDefaultDescription
PORT8000HTTP port
NODE_ENVdevelopmentdevelopment | production | staging | test
RUNTIME_WORKER_DIRSrequiredApp directories (PATH style, :-separated)
RUNTIME_PLUGIN_DIRS/data/.plugins:/data/pluginsPlugin directories (built-in first)
RUNTIME_POOL_SIZEenv-basedMaximum worker pool size
RUNTIME_EPHEMERAL_CONCURRENCY2Max in-flight requests for ttl: 0 apps
RUNTIME_EPHEMERAL_QUEUE_LIMIT100Max queue depth for ttl: 0 before 503
RUNTIME_WORKER_CONFIG_CACHE_TTL_MS1000Manifest cache TTL
RUNTIME_WORKER_RESOLVER_CACHE_TTL_MS1000Resolver cache TTL
RUNTIME_LOG_LEVELinfo (prod) / debug (dev)Log level
RUNTIME_API_PREFIX(empty)Moves the internal API: ""/api, "/_"/_/api
RUNTIME_ROOT_KEY(optional)Bootstrap root key (synthetic root principal, full access)
RUNTIME_STATE_DIR(optional)Where to store api-keys.db (bun:sqlite)
DELAY_MS100Delay before terminating a worker

Pool-size defaults by environment: development = 10, staging = 50, production = 500, test = 5.

Workers do not inherit the runtime environment. They receive a curated set (APP_DIR, ENTRYPOINT, WORKER_ID, WORKER_CONFIG, NODE_ENV, RUNTIME_*, RUNTIME_API_URL) plus anything declared in the app’s manifest.env / .env — after sensitive patterns (keys, tokens, passwords, DB URLs, cloud-provider credentials) are stripped. The full list and blocked patterns are in Worker Pool → Environment variables.

SourceDestinationPath
Built-in pluginBun.envmanifest.config → Helm generation → values.yaml + configmap.yaml → k8s ConfigMap → Bun.env
Uploaded pluginPluginContext.configmanifest.yaml → loader rescan → injected as ctx.config
Workerthe worker’s Bun.envmanifest.envloadWorkerConfig() → injected on spawn

Plugins always read with a fallback: Bun.env.X ?? config.x ?? "default".