Skip to content

Commit

Permalink
Remove process.env usage from the core (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
chungweileong94 authored May 6, 2023
1 parent 52a84c4 commit f0bc010
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/sour-laws-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@t3-oss/env-core": patch
---

Remove process.env usage
8 changes: 2 additions & 6 deletions packages/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export interface BaseOptions<

/**
* Whether to skip validation of environment variables.
* @default !!process.env.SKIP_ENV_VALIDATION && process.env.SKIP_ENV_VALIDATION !== "false" && process.env.SKIP_ENV_VALIDATION !== "0"
* @default false
*/
skipValidation?: boolean;
}
Expand Down Expand Up @@ -100,11 +100,7 @@ export function createEnv<
): z.infer<ZodObject<TServer>> & z.infer<ZodObject<TClient>> {
const runtimeEnv = opts.runtimeEnvStrict ?? opts.runtimeEnv ?? process.env;

const skip =
opts.skipValidation ??
(!!process.env.SKIP_ENV_VALIDATION &&
process.env.SKIP_ENV_VALIDATION !== "false" &&
process.env.SKIP_ENV_VALIDATION !== "0");
const skip = !!opts.skipValidation;
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-explicit-any
if (skip) return runtimeEnv as any;

Expand Down

1 comment on commit f0bc010

@vercel
Copy link

@vercel vercel bot commented on f0bc010 May 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

t3-env – ./

t3-env-t3-oss.vercel.app
t3-env.vercel.app
t3-env-git-main-t3-oss.vercel.app
env.t3.gg

Please sign in to comment.