I am using angular 8 and want to use CI/CD. till now I am storing secret key in environment file. for development I have created environment.dev.ts and for production it will environment.prod.ts.
While I am using CI/CD so I am thinking that instead storing it in environment file store it in bitbucket variables. and while deploying the variable can be changed.
I know if created variable SECRETKEY in bitbucket pipeline then I can use it like $SECRETKEY in package.json. can I use this in same way in any where in angular. like in environment.dev.ts or environment.prod.ts
let say if you want to read the BITBUCKET_BUILD_NUMBER from bit bucket in your angular application, it can be achieved in two simple steps.
1. Add the following line of code in your environment.prod.ts file
appVersion: '$BITBUCKET_BUILD_NUMBER',
2. In your .yml file add the following line under the scripts
- sed -i -e 's%$BITBUCKET_BUILD_NUMBER%'"$BITBUCKET_BUILD_NUMBER"'%g' ./src/environments/environment.dev.ts
Thanks for this, it was the piece I needed today.
-Jeff
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi there!
Seems like your questions is geared towards Angular's usage and not towards any of our Atlassian products. I'm afraid in that case we won't be able to help you, as this Community is centered around Atlassian and the members here might not be familiar with Angular. I encourage you to post your question in a different forum dedicated to that technology.
If I misunderstood your question and you were indeed referring to one of our products, please let us know so we can continue helping you.
Cheers,
Ana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.