Search code examples
node.jsenvironment-variablesnaming-conventions

Naming convention for environment variables files?


I was just wondering if there was any standardized convention for .env environment variable files. If I had multiple setups (e.g. development, staging, production), what should they be titled?

I've seen:

  • .env.development, ...
  • development.env, ...
  • settings.development.env, ...
  • .env, .env.staging, .env.production, ...

If there isn't a standard, are there arguments for which to use (kinda like "" vs '' for strings in JS)? Which do you use and why?


Solution

  • I prefer .env at the end ex: .production.env because last word after . indicates extension. VSCode does not recognize the file as .env file if you do .env.production

    VSCode Documentation: https://code.visualstudio.com/docs/python/environments#_environment-variables