Use of deployment variables within an application

Richard Alves de Oliveira October 4, 2023

Hello everybody, In my work, the need arose to use variables present in the deployment, within our application. I thought about using the Bitbucket API for this, but I didn't find how. Has anyone ever experienced this ?

1 answer

0 votes
Saxea _Flowie_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 4, 2023

Hi Richard,

One way to achieve this is to save the variables into a file and include it in the deployment.

Richard Alves de Oliveira October 5, 2023

Can you explain this solution better please?

Saxea _Flowie_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 5, 2023

You can do something like:

pipelines:
default:
- step:
name: Save Environment Variables
script:
- echo "MY_ENV_VAR=$MY_ENV_VAR" >> .env
- echo "ANOTHER_ENV_VAR=$ANOTHER_ENV_VAR" >> .env

then include .env file in our deployment.

Richard Alves de Oliveira October 19, 2023

It worked very well
Thanks!!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events