The environment variables should be placed in one place and then export to other files. However, some env variables like "host", and "port", database URL, and so on are hard-coded or imported directly from .env file. Some framework like .Net or Django has a setting file to assign all env variable and then abstractly use it in other files. This way will help our code base more maintainable.
Issues:
- May use index js to add all setting variables, or create a setting file
- Collect all environment variables scattered over the codebase, and place them in that file (mostly env)
- Replace env variables in the code base with the exported values from the setting file.
The environment variables should be placed in one place and then export to other files. However, some env variables like "host", and "port", database URL, and so on are hard-coded or imported directly from .env file. Some framework like .Net or Django has a setting file to assign all env variable and then abstractly use it in other files. This way will help our code base more maintainable.
Issues: