pubsub-emulator-ui icon indicating copy to clipboard operation
pubsub-emulator-ui copied to clipboard

feat: Add runtime configuration support for default host and auto-attach projects

Open jzaleski opened this issue 5 months ago • 0 comments

This PR introduces two new environment variable configurations for the PubSub Emulator UI, making it more flexible for containerized deployments:

  1. Auto-Attach Projects (AUTO_ATTACH_PUBSUB_PROJECTS)
  • Commit: 2e0ed4e - feat: Add auto-attach project support via AUTO_ATTACH_PUBSUB_PROJECTS env-var
  • Adds support for automatically attaching GCP projects on startup via the AUTO_ATTACH_PUBSUB_PROJECTS environment variable
  • Projects are specified as a comma-separated list and merged idempotently with existing localStorage projects
  • Implemented via a custom Docker entrypoint script that uses envsubst to inject runtime configuration into the Angular app through window.APP_CONFIG
  • Added .dockerignore to optimize Docker builds
  1. Configurable Default Host (DEFAULT_PUBSUB_EMULATOR_HOST)
  • Commit: 3fb2391 - feat: Add configurable default-host support via DEFAULT_PUBSUB_EMULATOR_HOST env-var + clean-up
  • Adds support for setting a default PubSub emulator host via the DEFAULT_PUBSUB_EMULATOR_HOST environment variable
  • Falls back to: "http://localhost:8681" if not specified
  • Updated Docker entrypoint to support both environment variables
  • Code cleanup: improved variable naming and removed unnecessary whitespace checks
  1. Protocol Auto-Prefix Fix
  • Commit: 331d7d0 - fix: Auto-prefix the default-host with "http://" if it is missing the protocol
  • Automatically prepends http:// to the default host if no protocol is specified
  • Prevents connection errors when users provide host addresses without the protocol prefix

Technical Implementation

All runtime configuration is injected through a Docker entrypoint script that uses envsubst to replace template variables in index.html, making these values available to the Angular app via window.APP_CONFIG object.

jzaleski avatar Nov 09 '25 19:11 jzaleski