[keyserver] Set default COMM_MYSQL_HOST=database in docker-compose.yml
Summary:
database is the hostname as specified in the docker-compose.yml, so the only way to reach it is with this hostname.
This diff uses a Docker syntax to specify a default hostname. From the docs:
Both $VARIABLE and ${VARIABLE} syntax are supported. Additionally when using the 2.1 file format, it is possible to provide inline default values using typical shell syntax:
${VARIABLE:-default} evaluates to default if VARIABLE is unset or empty in the environment.
${VARIABLE-default} evaluates to default only if VARIABLE is unset in the environment.
Note that right now this Docker Compose config only works with a single Node server connected with a single MySQL database. In the future, we might want to make it possible for the two to be separate. For now this isn't a major concern.
Test Plan:
- I removed COMM_MYSQL_HOST from my local keyserver/.env file, and confirmed the default applies and Node is able to connect to MySQL
- I tested setting COMM_MYSQL_HOST to an incorrect value in my local keyserver/.env file, and confirmed Node was using the value and was not able to connect to MySQL
Reviewers: palys-swm, atul
Reviewed By: palys-swm
Subscribers: Adrian, yayabosh
Differential Revision: https://phabricator.ashoat.com/D4139