Skip to content

Commit f8c32d1

Browse files
DC-5040 Env Vars via Config (#7227)
* added env vars section to various pages * minor coderabbit updates * verbose removed * test removed redirect list * removed quickstart addition * converted quickstarts back
1 parent e35e705 commit f8c32d1

File tree

4 files changed

+64
-6
lines changed

4 files changed

+64
-6
lines changed

.coderabbit.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
22
# yaml template to refer to https://docs.coderabbit.ai/reference/yaml-template#enterprise
33
language: "en-US"
4+
tone_instructions: "You are a principal engineer with natural teaching abilities. You detect issues and clearly explain why."
45
reviews:
56
collapse_walkthrough: false
67
profile: "chill"
@@ -14,6 +15,7 @@ reviews:
1415
auto_review:
1516
enabled: true
1617
drafts: false
18+
base_branches: [".*"]
1719
finishing_touches:
1820
docstrings:
1921
enabled: false

.github/workflows/lychee.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ jobs:
2525
--cache
2626
--cache-exclude-status 429,500,502,503,504
2727
--max-cache-age 5m
28-
--verbose
2928
--no-progress
3029
--accept 200,201,204,304,403,429
3130
--timeout 20
@@ -50,7 +49,6 @@ jobs:
5049
args: >
5150
--cache
5251
--max-cache-age 5m
53-
--verbose
5452
--no-progress
5553
--accept 200,201,204,304,403,429
5654
--cache-exclude-status 429,500,502,503,504
@@ -79,8 +77,8 @@ jobs:
7977
fi
8078
8179
if [ -n "$REPORT_FILE" ]; then
82-
# Read the original output
83-
ORIGINAL=$(cat "$REPORT_FILE")
80+
# Read the original output and remove everything after 'Redirects per input'
81+
ORIGINAL=$(cat "$REPORT_FILE" | sed '/^##* Redirects per input/,$d')
8482
8583
# Create formatted output
8684
cat > lychee/formatted.md << EOF
@@ -92,7 +90,7 @@ jobs:
9290
9391
EOF
9492
95-
# Append the original content with title replacement
93+
# Append the cleaned content with title replacement
9694
echo "$ORIGINAL" | sed 's/^# Summary$//' | sed 's/^## Summary$//' >> lychee/formatted.md
9795
fi
9896

content/200-orm/200-prisma-client/000-setup-and-configuration/010-generating-prisma-client.mdx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,35 @@ For improved compatibility with ECMAScript modules (ESM) and to ensure consisten
124124

125125
:::
126126

127+
## Loading environment variables
128+
129+
To load environment variables in your Prisma application, you can use the `prisma.config.ts` file along with the `env` helper from `prisma/config`. This approach provides better type safety and configuration management.
130+
131+
1. First, install the required dependency:
132+
133+
```bash
134+
npm install dotenv --save-dev
135+
```
136+
137+
2. Create a `.env` file in your project root (if it doesn't exist) and add your database connection string:
138+
139+
```env
140+
DATABASE_URL="your_database_connection_string_here"
141+
```
142+
143+
3. Update your `prisma.config.ts` file in your project root:
144+
145+
```ts
146+
import "dotenv/config";
147+
import { defineConfig, env } from "prisma/config";
148+
149+
export default defineConfig({
150+
datasource: {
151+
url: env("DATABASE_URL"),
152+
},
153+
});
154+
```
155+
127156
## The `@prisma/client` npm package
128157

129158
The `@prisma/client` npm package consists of two key parts:

content/200-orm/500-reference/325-prisma-config-reference.mdx

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,4 +597,33 @@ You can specify a custom location for your config file when running Prisma CLI c
597597

598598
```terminal
599599
prisma validate --config ./path/to/myconfig.ts
600-
```
600+
```
601+
602+
## Loading environment variables
603+
604+
To load environment variables in your Prisma application, you can use the `prisma.config.ts` file along with the `env` helper from `prisma/config`. This approach provides better type safety and configuration management.
605+
606+
1. First, install the required dependency:
607+
608+
```bash
609+
npm install dotenv --save-dev
610+
```
611+
612+
2. Create a `.env` file in your project root (if it doesn't exist) and add your database connection string:
613+
614+
```env
615+
DATABASE_URL="your_database_connection_string_here"
616+
```
617+
618+
3. Update your `prisma.config.ts` file in your project root:
619+
620+
```ts
621+
import "dotenv/config";
622+
import { defineConfig, env } from "prisma/config";
623+
624+
export default defineConfig({
625+
datasource: {
626+
url: env("DATABASE_URL"),
627+
},
628+
});
629+
```

0 commit comments

Comments
 (0)