Skip to content

Commit

Permalink
Update presets.ts (#279)
Browse files Browse the repository at this point in the history
Co-authored-by: Julius Marminge <[email protected]>
  • Loading branch information
thevisioner and juliusmarminge authored Jan 25, 2025
1 parent bb80923 commit 7c09bc3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/good-rabbits-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@t3-oss/env-core": patch
---

add netlify preset
1 change: 1 addition & 0 deletions docs/src/app/docs/customization/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ T3 Env ships the following presets out of the box, all importable from the `/pre
- `render` - Render environment variables. See full list [here](https://docs.render.com/environment-variables#all-runtimes).
- `railway` - Railway provided system environment variables. See full list [here](https://docs.railway.app/reference/variables#railway-provided-variables).
- `fly.io` - Fly.io provided machine runtime environment variables. See full list [here](https://fly.io/docs/machines/runtime-environment/#environment-variables).
- `netlify` - Netlify provided system environment variables. See full list [here](https://docs.netlify.com/configure-builds/environment-variables).

<Callout type="info">
Feel free to open a PR with more presets!
Expand Down
24 changes: 24 additions & 0 deletions packages/core/src/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,27 @@ export const fly = () =>
},
runtimeEnv: process.env,
});

/**
* Netlify Environment Variables
* @see https://docs.netlify.com/configure-builds/environment-variables
*/
export const netlify = () =>
createEnv({
server: {
NETLIFY: z.string().optional(),
BUILD_ID: z.string().optional(),
CONTEXT: z
.enum(["production", "deploy-preview", "branch-deploy", "dev"])
.optional(),
REPOSITORY_URL: z.string().optional(),
BRANCH: z.string().optional(),
URL: z.string().optional(),
DEPLOY_URL: z.string().optional(),
DEPLOY_PRIME_URL: z.string().optional(),
DEPLOY_ID: z.string().optional(),
SITE_NAME: z.string().optional(),
SITE_ID: z.string().optional(),
},
runtimeEnv: process.env,
});

0 comments on commit 7c09bc3

Please sign in to comment.