| #!/bin/bash |
| |
| DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" |
| TMPDIR="${TMPDIR:-/tmp}" |
| nohup bazelisk run --config=mayberemote //scripts/run_emulators "$@" > ${TMPDIR}/cloud_emulators.log & |
| |
| cmd="$1" |
| shift |
| |
| if [ "$cmd" == "start" ]; then |
| sleep 20 # Give the emulators time to start up before exiting. |
| |
| # The ports below should be kept in sync with run_emulators.go. |
| echo Emulators started. Set environment variables as follows: |
| echo export DATASTORE_EMULATOR_HOST=localhost:8891 |
| echo export BIGTABLE_EMULATOR_HOST=localhost:8892 |
| echo export PUBSUB_EMULATOR_HOST=localhost:8893 |
| echo export FIRESTORE_EMULATOR_HOST=localhost:8894 |
| echo export COCKROACHDB_EMULATOR_HOST=localhost:8895 |
| elif [ "$cmd" == "stop" ]; then |
| echo Emulators stopped. Unset environment variables as follows: |
| echo export DATASTORE_EMULATOR_HOST= |
| echo export BIGTABLE_EMULATOR_HOST= |
| echo export PUBSUB_EMULATOR_HOST= |
| echo export FIRESTORE_EMULATOR_HOST= |
| echo export COCKROACHDB_EMULATOR_HOST= |
| |
| if [ "$1" == "--dump-logs" ]; then |
| echo "Emulator logs:" |
| cat ${TMPDIR}/cloud_emulators.log |
| fi |
| fi |