Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add fly.io preset #254

Merged
merged 4 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/giant-kids-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@t3-oss/env-core": patch
---

fly.io 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 @@ -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).

<Callout type="info">
Feel free to open a PR with more presets!
Expand Down
22 changes: 22 additions & 0 deletions packages/core/src/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});