Ehsan Sarshar
Ehsan Sarshar

Reputation: 3211

run two instance of same app with different config file at same machine is it possible?

I have a node.js app with a mongodb database so I want to have two instance of an app running at the same time . one on production and one on development. so is it possible to set different NODE_ENV on different instance of an app.

Upvotes: 0

Views: 269

Answers (2)

Ankit Kumar Rajpoot
Ankit Kumar Rajpoot

Reputation: 5600

Use .env file via .gitignore if you will take a pull in both instances it won't transfer in your instance you will create .env in your project, then it will be different for both projects.

.env file for production

db = mongodb://XX.XXX.XX.XX/zXp
IAM_USER_SECRET = 06VXXXXXXXXXXXXXXXXXXXXXXRzC
NODE_ENV = production

.env file for development

db = mongodb://XX.XXX.XX.XX/zXp
IAM_USER_SECRET = 06VXXXXXXXXXXXXXXXXXXXXXXRzC
NODE_ENV = development

Upvotes: 0

Hussam
Hussam

Reputation: 1696

I think what you are asking can be achieved using:

NODE_ENV=development node server.js

You can run one instance with development and second one with production.

Upvotes: 1

Related Questions