Skip to content

Commit 2a74b72

Browse files
dburdanjuliusmarminge
andauthoredAug 25, 2024··
feat: add fly.io preset (#254)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
1 parent 5126706 commit 2a74b72

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed
 

‎.changeset/giant-kids-promise.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@t3-oss/env-core": patch
3+
---
4+
5+
fly.io preset

‎docs/src/app/docs/customization/page.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ T3 Env ships the following presets out of the box, all importable from the `/pre
100100
- `uploadthing` - All environment variables required to use [UploadThing](https://uploadthing.com/). More info [here](https://docs.uploadthing.com/getting-started/appdir#add-env-variables).
101101
- `render` - Render environment variables. See full list [here](https://docs.render.com/environment-variables#all-runtimes).
102102
- `railway` - Railway provided system environment variables. See full list [here](https://docs.railway.app/reference/variables#railway-provided-variables).
103+
- `fly.io` - Fly.io provided machine runtime environment variables. See full list [here](https://fly.io/docs/machines/runtime-environment/#environment-variables).
103104

104105
<Callout type="info">
105106
Feel free to open a PR with more presets!

‎packages/core/src/presets.ts

+22
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,25 @@ export const railway = () =>
100100
},
101101
runtimeEnv: process.env,
102102
});
103+
104+
/**
105+
* Fly.io Environment Variables
106+
* @see https://fly.io/docs/machines/runtime-environment/#environment-variables
107+
*/
108+
export const fly = () =>
109+
createEnv({
110+
server: {
111+
FLY_APP_NAME: z.string().optional(),
112+
FLY_MACHINE_ID: z.string().optional(),
113+
FLY_ALLOC_ID: z.string().optional(),
114+
FLY_REGION: z.string().optional(),
115+
FLY_PUBLIC_IP: z.string().optional(),
116+
FLY_IMAGE_REF: z.string().optional(),
117+
FLY_MACHINE_VERSION: z.string().optional(),
118+
FLY_PRIVATE_IP: z.string().optional(),
119+
FLY_PROCESS_GROUP: z.string().optional(),
120+
FLY_VM_MEMORY_MB: z.string().optional(),
121+
PRIMARY_REGION: z.string().optional(),
122+
},
123+
runtimeEnv: process.env,
124+
});

0 commit comments

Comments
 (0)
Please sign in to comment.