gcloud alpha emulators datastore env-init - print the commands required to export env variables of a datastore
gcloud alpha emulators datastore env-init [--data-dir=DATA_DIR] [GCLOUD_WIDE_FLAG ...]
(ALPHA) Prints the commands but does not execute them. It will output in shell syntax or on Windows it will be in cmd.exe syntax.
To print the env variables exports for a datastore emulator, run:
$ gcloud alpha emulators datastore env-init --data-dir=DATA-DIR
You can use this command to set env vars in a bash script by adding the below line in the script.
eval $(gcloud alpha emulators datastore env-init --data-dir=DATA-DIR)
- --data-dir=DATA_DIR
The directory to be used to store/retrieve data/config for an emulator run. The default value is <USER_CONFIG_DIR>/emulators/datastore. The value of USER_CONFIG_DIR can be found by running:
$ gcloud info --format='get(config.paths.global_config_dir)'
These flags are available to all commands: --access-token-file, --account, --billing-project, --configuration, --flags-file, --flatten, --format, --help, --impersonate-service-account, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity.
Run $ gcloud help for details.
This command is currently in alpha and might change without notice. If this command fails with API permission errors despite specifying the correct project, you might be trying to access an API with an invitation-only early access allowlist. This variant is also available:
$ gcloud beta emulators datastore env-init