Environment Variables

Read build-time public configuration from extension code. Only public values reach the extension bundle.

Read a variable

Use requireEnv when the product cannot work without a value. Use env for optional configuration that may be absent.

import { env, requireEnv } from "@/shared/lib/env";

const apiUrl = requireEnv("PUBLIC_API_URL");      // throws if missing
const optionalFlag = env("PUBLIC_FEATURE_FLAG");  // "" if missing

Secrets in extension code

A value marked secret is intentionally unavailable to browser code and never enters the extension bundle. Anything the shipped extension must read belongs in a public value.

For the full environment variables system (local vs production, public vs secret, the four generated files), see the Environment Variables page.