feat: Add PREEVY_HOST and PREEVY_ENV_ID environment variables #603
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.
This PR adds two new environment variables to enhance Preevy's service discovery capabilities, addressing specific user needs while maintaining full backward compatibility.
New Environment Variables
PREEVY_ENV_ID- Contains the environment ID (e.g.,my-app-main)PREEVY_HOST_{SERVICE}_{PORT}- Contains just the hostname without protocol or trailing slash (e.g.,frontend-3000-envid-clientid.livecycle.run)Problem Solved
Users reported limitations with the existing
PREEVY_BASE_URI_{SERVICE}_{PORT}variables:Example Usage
Before:
After:
Implementation Details
serviceLinkEnvVars()function to generate additional environment variablesURLconstructor with graceful fallback for invalid URLsBackward Compatibility
✅ All existing
PREEVY_BASE_URI_{SERVICE}_{PORT}variables work exactly as before✅ No breaking changes to existing functionality
✅ New variables are additive only
Testing
Documentation
Updated service discovery documentation with examples showing how to use all three types of environment variables together.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.