-
Notifications
You must be signed in to change notification settings - Fork 816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add next-runtime-env #869
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Important Auto Review SkippedAuto reviews are limited to the following labels: coderabbit. Please add one of these labels to enable auto reviews. Please check the settings in the CodeRabbit UI or the To trigger a single review, invoke the WalkthroughThe overarching change across the application involves the adoption of the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
@coderabbitai review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files ignored due to path filters (2)
package-lock.json
is excluded by:!**/*.json
package.json
is excluded by:!**/*.json
Files selected for processing (32)
- apps/web/src/app/(dashboard)/documents/[id]/edit-document.tsx (1 hunks)
- apps/web/src/app/(dashboard)/settings/billing/create-billing-portal.action.ts (1 hunks)
- apps/web/src/app/(dashboard)/settings/billing/create-checkout.action.ts (3 hunks)
- apps/web/src/app/(share)/share/[slug]/opengraph/route.tsx (3 hunks)
- apps/web/src/app/(share)/share/[slug]/page.tsx (2 hunks)
- apps/web/src/app/(unauthenticated)/signin/page.tsx (3 hunks)
- apps/web/src/app/(unauthenticated)/signup/page.tsx (2 hunks)
- apps/web/src/app/layout.tsx (4 hunks)
- apps/web/src/components/(dashboard)/avatar/avatar-with-recipient.tsx (3 hunks)
- apps/web/src/helpers/get-asset-buffer.ts (2 hunks)
- packages/ee/server-only/limits/client.ts (2 hunks)
- packages/email/template-components/template-document-self-signed.tsx (2 hunks)
- packages/email/template-components/template-reset-password.tsx (3 hunks)
- packages/lib/constants/app.ts (1 hunks)
- packages/lib/constants/feature-flags.ts (2 hunks)
- packages/lib/next-auth/auth-options.ts (3 hunks)
- packages/lib/server-only/auth/send-confirmation-email.ts (3 hunks)
- packages/lib/server-only/auth/send-forgot-password.ts (3 hunks)
- packages/lib/server-only/auth/send-reset-password.ts (2 hunks)
- packages/lib/server-only/document/delete-document.ts (3 hunks)
- packages/lib/server-only/document/resend-document.tsx (3 hunks)
- packages/lib/server-only/document/send-completed-email.ts (3 hunks)
- packages/lib/server-only/document/send-document.tsx (3 hunks)
- packages/lib/server-only/document/send-pending-email.ts (3 hunks)
- packages/lib/server-only/feature-flags/all.ts (3 hunks)
- packages/lib/server-only/feature-flags/get.ts (3 hunks)
- packages/lib/universal/get-base-url.ts (2 hunks)
- packages/lib/universal/upload/put-file.ts (2 hunks)
- packages/lib/universal/upload/server-actions.ts (2 hunks)
- packages/trpc/server/auth-router/router.ts (2 hunks)
- packages/trpc/server/singleplayer-router/router.ts (3 hunks)
- packages/ui/components/document/document-share-button.tsx (6 hunks)
Files skipped from review due to trivial changes (1)
- packages/lib/server-only/auth/send-reset-password.ts
Additional comments: 53
packages/lib/universal/get-base-url.ts (1)
- 2-4: The import of
env
from 'next-runtime-env' and its usage to retrieveNEXT_PUBLIC_WEBAPP_URL
is a positive change, enhancing modularity and maintainability by centralizing the retrieval of environment variables.packages/lib/constants/app.ts (1)
- 1-12: The use of
env
from 'next-runtime-env' to retrieve environment variables instead of directprocess.env
access is a good practice, improving security and flexibility in environment variable management.apps/web/src/helpers/get-asset-buffer.ts (1)
- 10-18: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-15]
The import of
env
from 'next-runtime-env' and its usage to retrieveNEXT_PUBLIC_WEBAPP_URL
for asset base URL retrieval is a good improvement, providing a more flexible and reliable way to access environment variables.apps/web/src/app/(dashboard)/settings/billing/create-billing-portal.action.ts (1)
- 3-18: The import of
env
from 'next-runtime-env' and its usage to retrieveNEXT_PUBLIC_WEBAPP_URL
for thereturnUrl
parameter increateBillingPortal
function is a good practice, enhancing flexibility in environment variable handling.packages/ee/server-only/limits/client.ts (2)
- 4-5: The modification of import statements for
TLimitsResponseSchema
andZLimitsResponseSchema
is a good practice, ensuring that only necessary types are imported.- 14-14: Updating the
url
construction in thegetLimits
function to handle potentially undefinedAPP_BASE_URL
is a good improvement, making the code more robust.apps/web/src/app/(unauthenticated)/signup/page.tsx (1)
- 13-21: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [5-18]
The addition of
env
from 'next-runtime-env' to retrieveNEXT_PUBLIC_DISABLE_SIGNUP
and its conditional usage to redirect users is a good practice, improving the handling and security of environment variables.apps/web/src/app/(unauthenticated)/signin/page.tsx (1)
- 12-19: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [4-27]
The addition of
env
from 'next-runtime-env' to retrieveNEXT_PUBLIC_DISABLE_SIGNUP
and its conditional usage within theSignInPage
component is a good practice, improving the handling and security of environment variables.packages/email/template-components/template-reset-password.tsx (1)
- 10-17: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-31]
The import of
env
from 'next-runtime-env' and its usage to retrieveNEXT_PUBLIC_WEBAPP_URL
for theTemplateResetPassword
component is a good improvement, replacing direct references toprocess.env
with a more flexible approach.packages/lib/constants/feature-flags.ts (1)
- 21-35: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-32]
The use of
env
from 'next-runtime-env' to retrieve environment variables instead of directprocess.env
access is a good practice, improving security and flexibility in environment variable management.apps/web/src/app/(share)/share/[slug]/page.tsx (1)
- 30-43: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-42]
The modifications, including the use of
type
keyword for importingMetadata
, addingenv
from 'next-runtime-env', and replacing directprocess.env
access withenv
function calls, are good practices that improve modularity and environment variable handling.apps/web/src/app/(dashboard)/settings/billing/create-checkout.action.ts (1)
- 31-43: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [3-41]
The import of
env
from 'next-runtime-env' and its usage to retrieveNEXT_PUBLIC_WEBAPP_URL
for thereturnUrl
parameter increateCheckout
function is a good practice, enhancing flexibility in environment variable handling.packages/lib/server-only/auth/send-forgot-password.ts (1)
- 12-19: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [3-37]
The import of
env
from 'next-runtime-env' and its usage to retrieveNEXT_PUBLIC_WEBAPP_URL
for thesendForgotPassword
function is a good improvement, replacing direct references toprocess.env
with a more flexible approach.packages/lib/universal/upload/put-file.ts (1)
- 12-21: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [2-18]
The addition of
env
from 'next-runtime-env' and its usage to retrieveNEXT_PUBLIC_UPLOAD_TRANSPORT
for theputFile
function is a good practice, improving the handling and security of environment variables.packages/lib/server-only/document/send-pending-email.ts (1)
- 13-20: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [3-48]
The import of
env
from 'next-runtime-env' and its usage to retrieveNEXT_PUBLIC_WEBAPP_URL
for thesendPendingEmail
function is a good improvement, replacing direct references toprocess.env
with a more flexible approach.apps/web/src/components/(dashboard)/avatar/avatar-with-recipient.tsx (1)
- 18-25: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [5-31]
The addition of
env
from 'next-runtime-env' to retrieveNEXT_PUBLIC_WEBAPP_URL
and its usage in theAvatarWithRecipient
function is a good practice, improving the handling and security of environment variables.packages/lib/server-only/auth/send-confirmation-email.ts (1)
- 12-21: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [3-42]
The import of
env
from 'next-runtime-env' and its usage to retrieve environment variables for thesendConfirmationEmail
function is a good improvement, replacing direct references toprocess.env
with a more flexible approach.packages/lib/server-only/feature-flags/all.ts (1)
- 12-20: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [4-49]
The import of
env
from 'next-runtime-env' and its usage to retrieveNEXT_PUBLIC_WEBAPP_URL
andNEXT_PUBLIC_MARKETING_URL
for thehandlerFeatureFlagAll
function is a good practice, improving the handling and security of environment variables.packages/lib/server-only/document/send-completed-email.ts (1)
- 40-51: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [3-48]
The import of
env
from 'next-runtime-env' and its usage to retrieveNEXT_PUBLIC_WEBAPP_URL
for thesendCompletedEmail
function is a good improvement, replacing direct references toprocess.env
with a more flexible approach.packages/trpc/server/auth-router/router.ts (1)
- 9-20: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [2-17]
The addition of
env
from 'next-runtime-env' to retrieveNEXT_PUBLIC_DISABLE_SIGNUP
and its usage in theauthRouter
module is a good practice, improving the handling and security of environment variables.packages/lib/server-only/document/delete-document.ts (1)
- 2-9: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [5-21]
The addition of
env
from 'next-runtime-env' and its usage to retrieveNEXT_PUBLIC_WEBAPP_URL
for thedeleteDocument
function is a good practice, improving the handling and security of environment variables.packages/email/template-components/template-document-self-signed.tsx (1)
- 12-20: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-17]
The import of
env
from 'next-runtime-env' and its usage to retrieveNEXT_PUBLIC_WEBAPP_URL
for theTemplateDocumentSelfSigned
component is a good improvement, replacing direct references toprocess.env
with a more flexible approach.packages/lib/server-only/document/resend-document.tsx (1)
- 16-23: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [3-75]
The import of
env
from 'next-runtime-env' and its usage to retrieveNEXT_PUBLIC_WEBAPP_URL
for theresendDocument
function is a good practice, improving the handling and security of environment variables.packages/lib/server-only/document/send-document.tsx (1)
- 16-23: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [3-67]
The import of
env
from 'next-runtime-env' and its usage to retrieveNEXT_PUBLIC_WEBAPP_URL
for thesendDocument
function is a good improvement, replacing direct references toprocess.env
with a more flexible approach.packages/lib/universal/upload/server-actions.ts (3)
- 14-14: The import of
env
fromnext-runtime-env
is correctly implemented to facilitate environment variable access in a more secure and flexible manner.- 21-21: The declaration of
NEXT_PUBLIC_UPLOAD_TRANSPORT
usingenv('NEXT_PUBLIC_UPLOAD_TRANSPORT')
is a good practice, ensuring that environment variables are accessed securely and consistently across the application.- 123-123: The conditional check
if (NEXT_PUBLIC_UPLOAD_TRANSPORT !== 's3')
correctly uses theNEXT_PUBLIC_UPLOAD_TRANSPORT
variable to determine the upload transport mechanism. This enhances the flexibility and configurability of the upload functionality.packages/lib/server-only/feature-flags/get.ts (4)
- 4-6: The adjustment in imports for
JWT
andgetToken
fromnext-auth/jwt
, and the introduction ofenv
fromnext-runtime-env
, are correctly implemented to align with the updated approach for handling authentication and environment variables.- 18-19: Correctly declaring
NEXT_PUBLIC_WEBAPP_URL
andNEXT_PUBLIC_MARKETING_URL
usingenv
ensures secure and consistent access to these environment variables across the application.- 65-65: The conditional check using
NEXT_PUBLIC_WEBAPP_URL
to determine the origin for CORS headers is a good practice, enhancing security by dynamically setting allowed origins based on environment configuration.- 69-69: Similarly, using
NEXT_PUBLIC_MARKETING_URL
for CORS header configuration further exemplifies the application's flexible and secure approach to handling cross-origin requests.apps/web/src/app/layout.tsx (5)
- 5-5: The import of
PublicEnvScript
andenv
fromnext-runtime-env
is correctly implemented, indicating a shift towards using environment variables for configuration within the application's layout.- 24-24: Correctly declaring
NEXT_PUBLIC_WEBAPP_URL
usingenv
ensures that the application can dynamically use the base URL for various purposes, such as constructing image URLs for social media sharing.- 42-42: Using
NEXT_PUBLIC_WEBAPP_URL
to dynamically set the image URL in the Open Graph metadata is a good practice, ensuring that the metadata reflects the correct base URL based on the deployment environment.- 47-47: Similarly, using
NEXT_PUBLIC_WEBAPP_URL
for Twitter card images ensures consistency and correctness in social media sharing functionality.- 69-69: The inclusion of
PublicEnvScript
in the document head is a necessary step for ensuring that environment variables are correctly exposed to the client-side of the application.apps/web/src/app/(share)/share/[slug]/opengraph/route.tsx (3)
- 4-4: The import of
env
fromnext-runtime-env
is correctly implemented, aligning with the application's strategy for securely accessing environment variables.- 26-26: Correctly declaring
NEXT_PUBLIC_WEBAPP_URL
usingenv
ensures that the application can dynamically use the base URL for generating Open Graph images, enhancing flexibility and configurability.- 43-43: Using
NEXT_PUBLIC_WEBAPP_URL
to construct the base URL for API calls related to sharing functionality is a good practice, ensuring that the application adapts to different deployment environments.packages/ui/components/document/document-share-button.tsx (7)
- 7-7: The import of
env
fromnext-runtime-env
is correctly implemented, facilitating secure and consistent access to environment variables within the component.- 42-42: Correctly declaring
NEXT_PUBLIC_WEBAPP_URL
usingenv
ensures that the component can dynamically construct share links and Open Graph image URLs based on the deployment environment.- 73-73: Using
NEXT_PUBLIC_WEBAPP_URL
to construct the share link URL is a good practice, ensuring that the links are correctly formed based on the current deployment environment.- 97-97: Pre-warming the Open Graph image by fetching it before sharing on Twitter, using
NEXT_PUBLIC_WEBAPP_URL
, is an effective way to ensure that the image is available when the tweet is viewed.- 105-105: Opening the Twitter share intent with a URL constructed using
NEXT_PUBLIC_WEBAPP_URL
ensures that the shared content is correctly linked back to the application.- 153-153: Displaying the share link in the UI using
NEXT_PUBLIC_WEBAPP_URL
ensures that users see the correct URL based on the deployment environment.- 165-165: Using
NEXT_PUBLIC_WEBAPP_URL
to construct the Open Graph image URL for display within the share dialog is a good practice, ensuring that the image is correctly sourced from the current deployment environment.packages/trpc/server/singleplayer-router/router.ts (3)
- 3-3: The import of
env
fromnext-runtime-env
is correctly implemented, aligning with the application's strategy for securely accessing environment variables in server-side logic.- 28-28: Correctly declaring
NEXT_PUBLIC_WEBAPP_URL
usingenv
ensures that server-side logic can dynamically use the base URL for constructing email templates and other URLs, enhancing flexibility and configurability.- 154-154: Using
NEXT_PUBLIC_WEBAPP_URL
to set theassetBaseUrl
in the email template is a good practice, ensuring that the email content correctly references assets based on the deployment environment.packages/lib/next-auth/auth-options.ts (3)
- 10-10: The import of
env
fromnext-runtime-env
is correctly implemented, facilitating secure and consistent access to environment variables within the authentication options configuration.- 20-20: Correctly declaring
NEXT_PUBLIC_DISABLE_SIGNUP
usingenv
ensures that the authentication logic can dynamically enable or disable signups based on the deployment environment.- 189-189: Using
NEXT_PUBLIC_DISABLE_SIGNUP
to conditionally allow sign-ins based on the environment configuration is a good practice, ensuring that the application can dynamically adapt its authentication behavior.apps/web/src/app/(dashboard)/documents/[id]/edit-document.tsx (1)
- 64-64: The correction of the typo in the variable declaration from "DcumentFlowStep" to "DocumentFlowStep" ensures the correctness and readability of the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it builds we ride 🏇🏻
This PR adds the package next-runtime-env to populate the public environment variables at runtime.