Control Convex env variables output location
Hi,
yarn convex dev seems to forcibly create env.local even though we have an .env file that we want to use instead.
We are in an Expo React Native app where we cannot reliably use env.local, instead we would ideally use env.development and env.production, but .env can suffice (env.local can not, however).
The docs https://docs.convex.dev/production/project-configuration#convexjson state that "npx convex dev writes the URL to the .env.local or .env file.", but we can only get it to write to .env.local.
We tried:
- Delete env.local and run convex dev: this prompts us to set up our project and populates env.local
- Paste contents from env.local into env and delete env.local
- Run convex dev again - does NOT prompt to set up project (so it recognizes env?) but DOES automatically populate env.local again (see screenshot)
Thanks!Project Configuration | Convex Developer Hub
Local development

3 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
Basically we would really like to be able to specify where
convex dev outputs the environment variables when running both the dev client and no-dev production environment.
Like this or whatever: ๐
convex.json:
I think maybe we solved it by following the standard .env file resolution that Expo uses: https://github.com/bkeepers/dotenv/blob/c6e583a/README.md#what-other-env-files-can-i-use
We changed our
env.development --> env.local.development and the same for production. Now our bundler correctly prioritizes these over env.local ๐
Maybe this is the intended approach then, and Convex dev spitting out stuff into env.local is no problem?GitHub
dotenv/README.md at c6e583adca988e92960d280c24adaaac68182342 ยท bkee...
A Ruby gem to load environment variables from
.env. - bkeepers/dotenv