-
Notifications
You must be signed in to change notification settings - Fork 110
Consistent configuration
In Node.js development, it is common that there are serveral envrionments like development, test, production and so. Corresponding to these envrioments are configurations differed from each other. Therefore, it is necessary to make these configuration consistently.
placeHolder is a signature indicating the place to be replaced by the specific envrioment value
in Bearcat, the placeHolder can be like this:
${car.num}
then in config.json file you can define car.num with the specific value
{
"car.num": 100
}
In Bearcat, you can write different environment configurations in the following structure:
in directory named config, you put dev and prod sub-directory named by specific envrioment, and then write the specific configurations in these directory corresponding to each environment.
In Bearcat, you can switch different environment in the following ways:
- run with env or --env args
node app.js env=prod
- run with NODE_ENV
NODE_ENV=prod node app.js
by default, the env is dev