Skip to content

feat: env validation#3548

Open
tefkah wants to merge 7 commits intomainfrom
tfk/env
Open

feat: env validation#3548
tefkah wants to merge 7 commits intomainfrom
tfk/env

Conversation

@tefkah
Copy link
Copy Markdown
Member

@tefkah tefkah commented Apr 1, 2026

  • feat: add env parsing
  • feat: use env

Issue(s) Resolved

This PR adds env variable validation using Zod at startup.

This prevents a class of issues of forgetting to set important env vars, leading to tricky to debug situations (or just a bunch of extra work)

Also nice: adds more typesafety

Kind of quirky in tests, but otherwise works fine!

Test Plan

See if everything works on Duqduq

Screenshots (if applicable)

Optional

Notes/Context/Gotchas

Supporting Docs

@tefkah tefkah requested a review from isTravis April 1, 2026 17:00
@tefkah tefkah marked this pull request as ready for review April 1, 2026 17:00

vi.mock('utils/import/uploadAndConvertImages', async () => {
if (process.env.AWS_ACCESS_KEY_ID) {
if (process.env.INTEGRATION) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Where does env.INTEGRATION come from for testing? Is that just set, so it roughly says, "If this is integration testing..."?

export const getUploadPolicy = ({ contentType }: GetUploadPolicyParams) => {
const acl = 'public-read';
const bucket = 'assets.pubpub.org';
const awsAccessKeyId = expect(process.env.AWS_ACCESS_KEY_ID);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It seems like there is new default logic around env variables now. Could you just clarify how defaults work now for non-existent vars? Is it just that they'd fail type checking before the runtime, so we don't need to do these checks?

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 this pull request may close these issues.

2 participants