Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to use environment variables in yaml configuration file?

I'm deploying my Laravel project on App Engine. I need to put some data like the password of the database in the app.yaml configuration file, I would like to do something like this when I have added $DB_PASSWORD in the environment variables of the Bitbucket repo.

runtime: php73
env_variables:

...

 DB_PASSWORD: $DB_PASSWORD 

 Is there any way to accomplish this?

1 answer

Hi @Dulce Hernandez Cruz ,

I don't really think the `env` set in bitbucket can be read by the App Engine `app.yml`. I suggest you do the following

1. Bitbucket pipelines ships with an awesome feature, Bitbucket pipes, which makes most of deployments easy. The good news, there exists a bitbucket pipe for Google App Engine, See Link below;
https://confluence.atlassian.com/bitbucket/deploy-to-google-cloud-900820342.html

below is a snipe you can apply, do everything you need like building the app and `env` all in within the pipeline, so by the time it's sent to App Engine, the `env` already exists;

image: node:10.15.1
# image: php:7.2-fpm pipelines: default: - step: name: Build and Test script: - cp .env.example .env
# pass environment variables in travis to the app
- sed -ri 's~^DB_PASSWORD=~DB_PASSWORD=\$DB_PASSWORD~' .env - step: name: Deploy script: - pipe: atlassian/google-app-engine-deploy:0.2.1 variables: KEY_FILE: $KEY_FILE PROJECT: 'my-project'

 

2. You can maintain your config and I believe the `env` variables within `app.yml` should be defined in App Engine rather than bitbucket

I hope this helps 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Admins, notify your Jira instance of system-wide changes with the new admin announcement banner

Hi All! We’re excited to share the launch of an announcement banner that lets Jira site administrators communicate directly to their users across their  Jira Cloud instance.  ...

395 views 13 14
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you