Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I access Bitbucket Pipelines environment variables from my source code?

I have my sensitive data as environment variables in Bitbucket Pipelines, e.g. database credentials. Is there a way I can access these environment variables from my source code? I do not want to push these sensitive data to my repository.

like image 899
user6754 Avatar asked Sep 13 '25 20:09

user6754


1 Answers

Bitbucket Pipelines environment variables are just regular environment variables. You can access them however you normally would; this depends on the programming language you are using.

For example, in Python you can use os.getenv(), which lets you optionally provide a default value to use in case the desired environment variable isn't available.

Without knowing more about your technology stack it's impossible to provide a more specific answer.

like image 178
Chris Avatar answered Sep 15 '25 21:09

Chris