I am storing certain sensitive data in environment variables in CircleCI’s project settings. How do I add them to my circle.yml file? I tried the following, but it doesn’t work:
Those last two lines aren’t needed here. You’d just use $CLIENT_ID or ${CLIENT_ID} in circle.yml where it’s needed. The’d also be available in scripts called via circle.yml.
This is assuming that $CLIENT_ID and $CLIENT_SECRET were configured as Environment Variables via CircleCI’s UI or API.
These variables are needed to run my tests. I have defined them in our project settings through CircleCI’s UI. I tried defining those variables in my circle.yml file because my tests cannot find those variables. Circle CI’s build page says that it is exporting those variables:
Hey aderhg, Did you ever solve this issue? I think I am running into the same thing. My Mocha tests can’t read ENV variables I have set through the Circle CI UI.
I believe Mocha is running as the same user. How can I check this? I have done nothing that would lead me to believe this is not the case
This is not running within Docker
I think this is CircleCI 2.0
I am using the correct capitalization for the variables
I am not storing non-ASCII characters in the variables
I checked the link you provided, but am still confused.
In my app.js I have this:
if (process.env.NODE_ENV !== 'production') {
require('dotenv').config();
}
I guess my question is why when in my test:
const authToken = process.env.AUTH_TOKEN
process.env.AUTH_TOKEN is not found when run by CircleCI?
Do these env variables need to be imported via the circle.yml file first and then retrieved from there?
Would I need to do something like this in my circle.yml file: