Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Node.js API Secret in Secure Environment Variable

Deleted user October 28, 2018

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

1 answer

0 votes
Philip Hodder
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 2, 2018

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

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, compass, developer experience, devex, platform engineering, internal developer platform, component catalog, atlassian learning, productivity tools, developer productivity, software architecture, compass webinar, engineering teams

Discover how Compass drives DevEx and productivity at Atlassian 🏃🏻‍♂️

Learn why Compass was built to tackle dev experience at scale. See how Atlassian uses it to boost visibility, reduce cognitive load, and drive consistency—plus tips to get started and customize your IDP for stronger team engagement.

Join the webinar ✨
AUG Leaders

Atlassian Community Events