Hi,
I am using JSON web tokens (as seen in this tutorial Node JS JSON Web Tokens) to secure an API application and I have been reading that I should not store my secret in a config.js file in the Node App, but instead I should use an environment variable and that on BitBucket, the environment variable should be "secure".
I can see on the BitBucket site where I can add a secure environment variables, but I am not sure how to access them. I assume there is something I need to write in my Pipeline to decrypt and use the token, but I am not sure how. I am currently deploying to heroku and using a simple script as my pipeline:
image: node:8.9.4
clone: depth: full
pipelines: branches: master:
- step: script:
- npm install
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git master
Can anyone shed any light on how to access the secure environment variable in the pipeline script?
Thank you
Hi Sydney,
When you have a secured environment variable setup, it will be injected into your Pipeline ready to use without additional configuration. However, we mask the value of the variable. You should be able to reference it like any other environment variable.
Are you encountering any errors when using secured environment variables?
Thanks,
Phil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.