summaryrefslogtreecommitdiff
path: root/src/lib/env.ts
diff options
context:
space:
mode:
authorJoão Augusto Costa Branco Marado Torres <torres.dev@disroot.org>2025-07-06 15:10:35 -0300
committerJoão Augusto Costa Branco Marado Torres <torres.dev@disroot.org>2025-07-06 15:10:35 -0300
commit87df5a27cb34ada02f54dacf4299574f04038612 (patch)
treeedd286add16ec82bc4b8467566ede15a90883a39 /src/lib/env.ts
parent04bcfc551e3f446d26358971115ac27e34f03e44 (diff)
fix: env name conflict
Signed-off-by: João Augusto Costa Branco Marado Torres <torres.dev@disroot.org>
Diffstat (limited to 'src/lib/env.ts')
-rw-r--r--src/lib/env.ts68
1 files changed, 0 insertions, 68 deletions
diff --git a/src/lib/env.ts b/src/lib/env.ts
deleted file mode 100644
index 679c76f..0000000
--- a/src/lib/env.ts
+++ /dev/null
@@ -1,68 +0,0 @@
-import { createEnv } from "@t3-oss/env-core";
-import { z } from "astro:content";
-
-export const env = createEnv({
- server: {
- TRUSTED_KEYS_DIR: z.string().superRefine((val, ctx) => {
- let url: URL;
- const cwd = new URL(`file://${Deno.cwd()}/`);
- try {
- url = new URL(val, cwd);
- } catch {
- ctx.addIssue({
- code: "custom",
- message: `${cwd}${val} doesn't exist`,
- fatal: true,
- });
- return;
- }
-
- const { isDirectory } = Deno.statSync(url);
-
- if (isDirectory) return;
-
- ctx.addIssue({
- code: "custom",
- message: `${url} it's not a directory`,
- fatal: true,
- });
- }).transform((val) => new URL(val, new URL(`file://${Deno.cwd()}/`))),
- },
-
- /**
- * The prefix that client-side variables must have. This is enforced both at
- * a type-level and at runtime.
- */
- clientPrefix: "PUBLIC_",
- client: {
- PUBLIC_SITE_URL: z.string().url(),
- PUBLIC_SITE_TITLE: z.string().trim().min(1),
- PUBLIC_SITE_DESCRIPTION: z.string().trim().min(1),
- PUBLIC_SITE_AUTHOR: z.string().trim().min(1),
- PUBLIC_GIT_URL: z.string().url(),
- PUBLIC_TOR_URL: z.string().url().optional(),
- PUBLIC_GIT_TOR_URL: z.string().url().optional(),
- PUBLIC_SIMPLE_X_ADDRESS: z.string().url().optional(),
- },
-
- /**
- * What object holds the environment variables at runtime. This is usually
- * `process.env` or `import.meta.env`.
- */
- runtimeEnv: import.meta.env ?? Deno.env.toObject(),
-
- /**
- * By default, this library will feed the environment variables directly to
- * the Zod validator.
- *
- * This means that if you have an empty string for a value that is supposed
- * to be a number (e.g. `PORT=` in a ".env" file), Zod will incorrectly flag
- * it as a type mismatch violation. Additionally, if you have an empty string
- * for a value that is supposed to be a string with a default value (e.g.
- * `DOMAIN=` in an ".env" file), the default value will never be applied.
- *
- * In order to solve these issues, we recommend that all new projects
- * explicitly specify this option as true.
- */
- emptyStringAsUndefined: true,
-});