.env file and CircleCI

Hello all,

I’m having some trouble understanding this particular subject, so I’d appreciate your help.
Our project is NodeJS and we are currently using a “.env” file which contains all sorts of variables needed for the app and the tests. This file is not in our Github, it is currently placed manually in each server our app runs on (it has secrets in it which we do not want in our repository). What I’m having trouble understanding is how can I get these variables into the docker container that CircleCI runs our code on.

I’d love to get a simple explanation on how to get this working…

Thanks

1 Like

The normal approach is to put secrets in here:

https://circleci.com/bb/yourusername/yourproject/edit#env-vars

where:

  • yourusername is your CircleCI/BB username
  • yourproject is your repository name

These env vars will be created in your primary (first) container in your docker list. If you specifically need a .env file, you can write a shell script to convert your env vars into the file you need.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.