RJ
RJ2y ago

Determine whether deployment is prod or dev

Is there a way to determine, in the context of a Convex function, whether or not the deployment environment of that function is prod or dev? I know that I can facilitate this by manually setting env vars in each context, but it would be convenient if I were able to instead just reach for something like process.env.CONVEX_DEPLOYMENT: "production" | "development".
2 Replies
Michal Srb
Michal Srb2y ago
Yup, we're thinking about adding this!
ian
ian2y ago
Tactically I'd recommend setting just one env variable: PROD=true in production, then new dev deployments can just check !process.env.PROD. Doing this once per project doesn't seem like a huge lift. I agree that setting things once per deployment would be a bigger hassle.

Did you find this page helpful?