Skip to content

Having to supply empty values for optional environment variables is tedious #10000

@markjaquith

Description

@markjaquith

Describe the problem

Static environment variables must be present at build-time. See #6165

This means that every time I add a feature I want to be controlled by an environment variable, I need to add a value (even if it is a blank value) to my deployment tool (Cloudflare Pages), my CI tool (GitHub Actions), my own local environment (.env) and also notify all other developers on the project that they should update their .env files with this blank value. If this value were a necessary thing, like an API key required for the app to work, that would be expected. But when it's for a feature flag or some metrics or error-reporting thing that is only needed in production, it feels like a lot of unnecessary work.

Describe the proposed solution

I would love a way to supply default values for env vars.

Alternatives considered

I considered making a .env.example file and a script that compares .env.example and .env and populates .env with any missing values on yarn dev or yarn build

Importance

nice to have

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions