I have a file name .env.development in the root folder. I had install env-cmd as dev dependencies
when I start the server
> npm run develop
You can rename .env.development to just .env and then run env-cmd gatsby develop, this will look for environment variables inside .env file.
You can also update the develop node script inside the package.json like the following:
"develop": "env-cmd gatsby develop"
Then you can run the node script,
npm run develop
or
gatsby develop