As the title says, is there any way to use dotenv with Bitbucket Pipelines for CI purposes, while still adding the (perhaps multiple) (.stage).env
to .gitignore?
I know Pipeline supports environment variables, and that they can be referenced in bitbucket-pipelines.yml, but I can't figure out how to use dotenv
files instead, and vary which file to use based on i.e. branch patterns.
For example, I'd like commits to develop
to use .test.env
variables, while commits to master
instead uses the variables from .prod.env
.
Perhaps I'm going down the wrong path? Although other websites use examples of multiple .env
files, the library authors discourage that approach. I'm using Zeit Now for hosting, so I can't just SSH a .env
file onto the server.
Any advice is very welcome :-)
Rename the files inside your develop pipelines:
mv .test.env .env
or in your master pipelines:
mv .prod.env .env
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With