Skip to content

Commit

Permalink
feat: add fly.io preset (#254)
Browse files Browse the repository at this point in the history
Co-authored-by: Julius Marminge <[email protected]>
  • Loading branch information
dburdan and juliusmarminge authored Aug 25, 2024
1 parent 5126706 commit 2a74b72
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
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,
});

0 comments on commit 2a74b72

Please sign in to comment.