| #!/bin/bash |
| |
| DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" |
| nohup go run $DIR/run_emulators.go "$@" > /tmp/cloud_emulators.log 2>&1 & |
| |
| if [ "$1" == "start" ]; then |
| sleep 5 # 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 [ "$1" == "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= |
| fi |