pubsub-emulator-ui
pubsub-emulator-ui copied to clipboard
feat: Add runtime configuration support for default host and auto-attach projects
This PR introduces two new environment variable configurations for the PubSub Emulator UI, making it more flexible for containerized deployments:
- Auto-Attach Projects (
AUTO_ATTACH_PUBSUB_PROJECTS)
- Commit: 2e0ed4e - feat: Add auto-attach project support via
AUTO_ATTACH_PUBSUB_PROJECTSenv-var - Adds support for automatically attaching GCP projects on startup via the
AUTO_ATTACH_PUBSUB_PROJECTSenvironment 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
envsubstto inject runtime configuration into the Angular app through window.APP_CONFIG - Added .dockerignore to optimize Docker builds
- Configurable Default Host (
DEFAULT_PUBSUB_EMULATOR_HOST)
- Commit: 3fb2391 - feat: Add configurable default-host support via
DEFAULT_PUBSUB_EMULATOR_HOSTenv-var + clean-up - Adds support for setting a default PubSub emulator host via the
DEFAULT_PUBSUB_EMULATOR_HOSTenvironment 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
- 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.