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

狂风中的少年 提交于 2019-12-23 17:37:01

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/45917906/can-i-access-bitbucket-pipelines-environment-variables-from-my-source-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!