diff --git a/.changeset/giant-kids-promise.md b/.changeset/giant-kids-promise.md new file mode 100644 index 0000000..e34ebee --- /dev/null +++ b/.changeset/giant-kids-promise.md @@ -0,0 +1,5 @@ +--- +"@t3-oss/env-core": patch +--- + +fly.io preset diff --git a/docs/src/app/docs/customization/page.mdx b/docs/src/app/docs/customization/page.mdx index af3831f..7dfac5e 100644 --- a/docs/src/app/docs/customization/page.mdx +++ b/docs/src/app/docs/customization/page.mdx @@ -100,6 +100,7 @@ T3 Env ships the following presets out of the box, all importable from the `/pre - `uploadthing` - All environment variables required to use [UploadThing](https://uploadthing.com/). More info [here](https://docs.uploadthing.com/getting-started/appdir#add-env-variables). - `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). Feel free to open a PR with more presets! diff --git a/packages/core/src/presets.ts b/packages/core/src/presets.ts index 8e5aa37..5538463 100644 --- a/packages/core/src/presets.ts +++ b/packages/core/src/presets.ts @@ -100,3 +100,25 @@ export const railway = () => }, runtimeEnv: process.env, }); + +/** + * Fly.io Environment Variables + * @see https://fly.io/docs/machines/runtime-environment/#environment-variables + */ +export const fly = () => + createEnv({ + server: { + FLY_APP_NAME: z.string().optional(), + FLY_MACHINE_ID: z.string().optional(), + FLY_ALLOC_ID: z.string().optional(), + FLY_REGION: z.string().optional(), + FLY_PUBLIC_IP: z.string().optional(), + FLY_IMAGE_REF: z.string().optional(), + FLY_MACHINE_VERSION: z.string().optional(), + FLY_PRIVATE_IP: z.string().optional(), + FLY_PROCESS_GROUP: z.string().optional(), + FLY_VM_MEMORY_MB: z.string().optional(), + PRIMARY_REGION: z.string().optional(), + }, + runtimeEnv: process.env, + });