Skip to content

Instantly share code, notes, and snippets.

Avatar

Miguel Pereira mpereira-dev

  • SBS
  • Washington DC
View GitHub Profile
@mpereira-dev
mpereira-dev / getDBCredentials.sh
Last active Aug 17, 2020
Extract PostgreSQL Credentials for a Pivotal Cloud Foundry App
View getDBCredentials.sh
# * Extract PostgreSQL credentials from a bound service for use in this PCF app.
# ! Your manfiest file must bind the app to an existing PostgreSQL service via 'services'.
# @env VCAP_SERVICES - The Cloud Foundry services this app is bound to. This is set automatically for you.
# @env POSTGRES_SERVICE - The name of the specific PostgreSQL service to use. This is useful if your app is bound to multiple services.
# @env POSTGRES_SERVICE_KEY - The PostgreSQL service vendor key. Defaults to aws-rds-postgres for AWS.
# ? Reference: https://docs.cloudfoundry.org/devguide/deploy-apps/environment-variable.html#VCAP-SERVICES
function getDBCredentials {
echo "[INFO] Extracting DB credentials from VCAP_SERVICES...";
# Assume it is an AWS RDS PostgreSQL service if not specified.
You can’t perform that action at this time.