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

devDefault does not work when NODE_ENV is undefined #221

Open
huseeiin opened this issue Apr 14, 2024 · 1 comment · May be fixed by #222
Open

devDefault does not work when NODE_ENV is undefined #221

huseeiin opened this issue Apr 14, 2024 · 1 comment · May be fixed by #222

Comments

@huseeiin
Copy link

process.env.NODE_ENV is undefined but var with devDefault throws error?

reprod

export const { PORT, isProd } = cleanEnv(Bun.env, {
  PORT: port({ devDefault: 3000 }),
});
huseeiin added a commit to huseeiin/envalid that referenced this issue Apr 23, 2024
@huseeiin huseeiin linked a pull request Apr 23, 2024 that will close this issue
@af
Copy link
Owner

af commented Apr 24, 2024

Thanks for that PR! I hope my comment on it explains things, but essentially when NODE_ENV is missing, envalid always assumes production mode, just to be safe.

Maybe we could add some messaging in the error by default if NODE_ENV is not set at all, so this is more clear?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants