Skip to content

EnvironmentVariable

Source: src/Prisma/EnvironmentVariable.ts

A Prisma compute environment variable.

Values are write-only in Prisma. Alchemy stores them as Redacted values and reapplies the desired value to repair drift.

Project-level production variable

yield* Prisma.EnvironmentVariable("api-url", {
project: project.projectId,
// No branchId: this is a project-level template.
class: "production",
key: "API_URL",
value: Redacted.make("https://api.example.com"),
});

Preview branch override

yield* Prisma.EnvironmentVariable("preview-api-url", {
project,
branchId: preview.branchId,
// Branch overrides always use the preview class.
class: "preview",
key: "API_URL",
value: Redacted.make("https://preview.example.com"),
});