Skip to content

feat(config): add env helper#28305

Merged
jkomyno merged 1 commit intomainfrom
push-zqmpzoxvmmuu
Oct 16, 2025
Merged

feat(config): add env helper#28305
jkomyno merged 1 commit intomainfrom
push-zqmpzoxvmmuu

Conversation

@aqrln
Copy link
Copy Markdown
Member

@aqrln aqrln commented Oct 16, 2025

Add a helper that safely checks if an environment variable is defined and is not empty, and returns its value if so, otherwise throws an error.

This allows users to avoid having boilerplate code related to environment variables in their config files or using unsafe assertions like process.env.DATABASE_URL!.

Usage:

import { defineConfig, env } from '@prisma/config'

export default defineConfig({
  engine: 'classic',
  datasource: {
    url: env('DATABASE_URL'),
  },
})

Closes: https://linear.app/prisma-company/issue/TML-1508/env-helper-in-prismaconfig

@aqrln aqrln added this to the 6.18.0 milestone Oct 16, 2025
Copilot AI review requested due to automatic review settings October 16, 2025 09:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@aqrln aqrln force-pushed the push-zqmpzoxvmmuu branch from 905643f to fa56a95 Compare October 16, 2025 09:42
@aqrln aqrln requested a review from Copilot October 16, 2025 09:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@aqrln aqrln force-pushed the push-zqmpzoxvmmuu branch from fa56a95 to 0a31d9c Compare October 16, 2025 09:50
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 16, 2025

size-limit report 📦

Path Size
packages/client/runtime/library.js 197.77 KB (0%)
packages/client/runtime/library.d.ts 126.71 KB (0%)
packages/client/runtime/binary.js 658.34 KB (0%)
packages/client/runtime/binary.d.ts 26 B (0%)
packages/client/runtime/edge.js 166.66 KB (0%)
packages/client/runtime/edge-esm.js 166.12 KB (0%)
packages/client/runtime/wasm-engine-edge.js 128.78 KB (0%)
packages/client/runtime/index-browser.js 34.5 KB (0%)
packages/client/runtime/index-browser.d.ts 11.64 KB (0%)
packages/cli/build/index.js 2.68 MB (0%)
packages/client/prisma-client-0.0.0.tgz 25.93 MB (+0.01% 🔺)
packages/cli/prisma-0.0.0.tgz 16.75 MB (-0.01% 🔽)
packages/bundle-size/da-workers-libsql/output.tgz 924.95 KB (0%)
packages/bundle-size/da-workers-neon/output.tgz 999.02 KB (0%)
packages/bundle-size/da-workers-pg/output.tgz 998.19 KB (0%)
packages/bundle-size/da-workers-planetscale/output.tgz 941.41 KB (0%)
packages/bundle-size/da-workers-d1/output.tgz 906.8 KB (0%)

jkomyno
jkomyno previously approved these changes Oct 16, 2025
Add a helper that safely checks if an environment variable is defined
and is not empty, and returns its value if so, otherwise throws an
error.

This allows users to avoid having boilerplate code related to
environment variables in their config files or using unsafe assertions
like `process.env.DATABASE_URL!`.

Usage:

```ts
import { defineConfig, env } from '@prisma/config'

export default defineConfig({
  engine: 'classic',
  datasource: {
    url: env('DATABASE_URL'),
  },
})
```

Closes: https://linear.app/prisma-company/issue/TML-1508/env-helper-in-prismaconfig
@aqrln aqrln force-pushed the push-zqmpzoxvmmuu branch from 2725226 to 8b71f16 Compare October 16, 2025 11:25
@jkomyno jkomyno merged commit 0b2d3a8 into main Oct 16, 2025
813 of 814 checks passed
@jkomyno jkomyno deleted the push-zqmpzoxvmmuu branch October 16, 2025 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants