feat(emulate): add --slug option to namespace portless aliases#92
Open
gmackie wants to merge 1 commit intovercel-labs:mainfrom
Open
feat(emulate): add --slug option to namespace portless aliases#92gmackie wants to merge 1 commit intovercel-labs:mainfrom
gmackie wants to merge 1 commit intovercel-labs:mainfrom
Conversation
When running multiple projects with --portless, aliases like github.emulate collide because they are derived only from the service name. The second instance silently overwrites the first via --force, and shutdown of either instance removes the alias for both. --slug <name> namespaces aliases to <service>.<slug>.emulate, producing URLs like https://github.myapp.emulate.localhost. The slug can be set via CLI flag, or as a top-level `slug` field in emulate.config.yaml (CLI flag takes precedence). Without --slug, behavior is unchanged. Additional improvements: - Validate slug as a DNS label (lowercase alnum + hyphens, max 63 chars) - Register portless aliases after servers bind to avoid dangling aliases on port conflicts - Update init command output to suggest --portless when slug is configured Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
@gmackie is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
--slugoption toemulate startandemulate initthat namespaces portless aliases per project.Motivation
Each emulate instance holds mutable runtime state (issues, customers, messages, sessions, etc.) with no tenant isolation, so running multiple projects against a single instance causes state crosstalk. Running separate instances per project is a simple solution — tenant-level namespacing would also work but would be a significant overhaul to the project.
In port-based mode, separate instances are trivial — just use different
--portranges. But in--portlessmode, aliases are derived solely from the service name (github.emulate,stripe.emulate). A second instance silently overwrites the first's aliases via--force, and shutdown of either instance removes the alias for both.--base-urlcan't help here — it's mutually exclusive with--portlessand only affects advertised URLs, not alias registration.--slugnamespaces both the portless alias and the advertised URL, allowing concurrent instances without collisions.Changes
--slugtostartandinitcommandsslugtop-level key), CLI flag takes precedenceinitoutput to suggest--portlesswhen slug is configuredUsage
emulate init --slug myappwrites theslugfield to the generated config. Without--slug, no slug is written and portless behaves as before.Test plan
--portless --slug myappregisters aliases asgithub.myapp.emulateand serves athttps://github.myapp.emulate.localhost--portlesswithout slug behaves identically to before--slugwithout--portlesserrors with a clear message🤖 Generated with Claude Code