config/envs

madDreamer96·2023년 3월 31일
0

If you have a .env file at the root of your Node.js project, you can indeed use environment variables directly from process.env without needing to call the config function from the dotenv package.

However, if you have multiple .env files with different sets of environment variables, as is the case with configs/common.env and configs/database.env in the code you provided, you need to use the config function to load the variables from each file into process.env. This allows you to selectively load different sets of environment variables for different parts of your application.

If you don't have this requirement, you can just use a single .env file at the root of your project and access the variables directly from process.env.

profile
hello world

0개의 댓글