I am working on a NodeJS application which is a containerized application. I use Jenkins to build and deploy it. I have an environment .env
file and along with this, also have .env
files based on environments.
For example: .env.DEV
, .env.SQA
, .env.STG
and .env.PROD
.
Each file has different values for the variables based on environments.
When I am deploying my application, it always fetches variables from the .env
file instead of specific environment file i.e. .env.DEV
(if deploying on DEV server).
How do we use specific environment file while doing the deployment on Jenkins?
Note: I followed this great content on dotenv
library but I didn't find anything helpful for my use-case. I did some research on the web, but didn't find much on this.