This command is used to setup pubsub topics & subscriptions
- from sources:
npm install
npm run build
npm link- using NPM:
npm install -g @elmy-oss/init-pubsub-cli- when globally installed
init-pubsub --env=./example.local.env scripts/initPubSub/config.json- explicit call using
npm/npx
npx @elmy-oss/init-pubsub-cli ./scripts/initPubSub/config.jsonPUBSUB_EMULATOR_HOST: is the host of the pubsub emulator (edit accordingly when port-forwarding from test envs)PUBSUB_PROJECT_ID: is the project id of the google pubsub project- Please note that you have the option to use current shell's environment variables or to utilize an
.envfile. Additionally, you can specify an alternate dotenv file by using the--env=dotenv-fileswitch, as demonstrated in the Run section above.
- Either copy
example.local.envorexample.testenv.envto.envand edit accordingly - or define environment variables
PUBSUB_EMULATOR_HOST&PUBSUB_PROJECT_IDin your shell before running
Topics & subscription mappings are found in a config.json file
- an example is provided in
example-config.json.
{
"topic1-with-single-sub": ["topic1-sub1"],
"topic2-with-subs": [
"topic2-sub1",
"topic2-sub2"
],
"topic3-without-sub": []
}