2
0

🧑‍💻 Automatically guess env URLs for Vercel preview deploy… (#1076)

…ments

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced new URL processing logic to enhance compatibility with
Vercel preview environments.
- Improved handling of environment-specific URLs for authentication and
viewer services.

- **Enhancements**
- Streamlined environment variable management for more reliable
deployment configurations.

- **Documentation**
- Updated documentation to reflect new environment variable processing
functions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Baptiste Arnaud
2023-12-05 10:59:19 +01:00
committed by GitHub
parent 99c5aafec1
commit d89a1eb323
3 changed files with 78 additions and 5 deletions

View File

@ -8,6 +8,19 @@ const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
const injectViewerUrlIfVercelPreview = (val) => {
if (
(val && typeof val === 'string' && val.length > 0) ||
process.env.VERCEL_ENV !== 'preview' ||
!process.env.VERCEL_BUILDER_PROJECT_NAME ||
!process.env.NEXT_PUBLIC_VERCEL_VIEWER_PROJECT_NAME
)
return
process.env.NEXT_PUBLIC_VIEWER_URL = `https://${process.env.VERCEL_BRANCH_URL}`
}
injectViewerUrlIfVercelPreview(process.env.NEXT_PUBLIC_VIEWER_URL)
configureRuntimeEnv()
const landingPagePaths = [