We have a client site on Platform.sh that has two databases - our primary Symfony database, and a legacy Drupal 7 database which is mostly used as a legacy data storage / migration source.
Currently, the Symfony Flex bridge only automatically configures a single database relationship into the DATABASE_URL environment variable.
This PR adds some flexibility - you can now define a DATABASE_RELATIONSHIPS environment variable in your Platform.sh environment that lists one or more database relationships to be configured. If this variable is not provided, the database relationship is still attempted by default, similar to the current behaviour.
Each relationship is then mapped to a <RELATIONSHIP_NAME>_URL environment variable named by taking the relationship name, uppercasing it, and appending _URL'. For example, adatabase_legacyrelationship would be mapped to aDATABASE_LEGACY_URL` environment variable.
I've also included updates to the README to document the added functionality.
We have a client site on Platform.sh that has two databases - our primary Symfony database, and a legacy Drupal 7 database which is mostly used as a legacy data storage / migration source.
Currently, the Symfony Flex bridge only automatically configures a single
database
relationship into theDATABASE_URL
environment variable.This PR adds some flexibility - you can now define a
DATABASE_RELATIONSHIPS
environment variable in your Platform.sh environment that lists one or more database relationships to be configured. If this variable is not provided, thedatabase
relationship is still attempted by default, similar to the current behaviour.Each relationship is then mapped to a
<RELATIONSHIP_NAME>_URL
environment variable named by taking the relationship name, uppercasing it, and appending_URL'. For example, a
database_legacyrelationship would be mapped to a
DATABASE_LEGACY_URL` environment variable.I've also included updates to the README to document the added functionality.