gcloud alpha emulators pubsub env-init

NAME
gcloud alpha emulators pubsub env-init - print the commands required to export pubsub emulator's env variables
SYNOPSIS
gcloud alpha emulators pubsub env-init [--data-dir=DATA_DIR] [GCLOUD_WIDE_FLAG]
DESCRIPTION
(ALPHA) After starting the emulator, you need to set environment variables so that your application connects to the emulator instead of the production environment. Environment variables need to be set each time you start the emulator. The environment variables depend on dynamically assigned port numbers that could change when you restart the emulator.
EXAMPLES
To print the env variables exports for a pubsub emulator, run:
gcloud alpha emulators pubsub env-init --data-dir=DATA-DIR

For a detailed walkthrough of setting Pub/Sub emulator environment variables, see https://cloud.google.com/pubsub/docs/emulator#env.

FLAGS
--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/pubsub. The value of USER_CONFIG_DIR can be found by running:
gcloud info --format='get(config.paths.global_config_dir)'
GCLOUD WIDE FLAGS
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.

NOTES
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 pubsub env-init