-
Notifications
You must be signed in to change notification settings - Fork 265
Update env config #1320
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
Update env config #1320
Conversation
✅ Deploy Preview for docs-optimism ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
📝 WalkthroughWalkthroughThe changes update the initialization logic in the GrowthBook module and adjust the attribute handling in the theme configuration. In the Sequence Diagram(s)sequenceDiagram
participant App as Application
participant GB as GrowthBook
App->>GB: Request initialization
GB->>GB: Read env vars (apiHost, clientKey)
alt Both env vars are set
GB->>GB: Call init() method
else Env vars missing
GB->>GB: Use default empty string values
end
Tip 🌐 Web search-backed reviews and chat
✨ Finishing Touches
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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
lib/growthbook.ts (1)
9-11
: Consider adding a debug log for initialization status.While the initialization check is correct, adding a debug log would help track when GrowthBook is initialized vs skipped.
if (process.env.NEXT_PUBLIC_GROWTHBOOK_API_HOST && process.env.NEXT_PUBLIC_GROWTHBOOK_CLIENT_KEY) { + console.debug('Initializing GrowthBook with provided credentials'); growthbook.init(); +} else { + console.debug('Skipping GrowthBook initialization due to missing credentials'); }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
lib/growthbook.ts
(1 hunks)theme.config.tsx
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Redirect rules - docs-optimism
- GitHub Check: Header rules - docs-optimism
- GitHub Check: Pages changed - docs-optimism
- GitHub Check: pr-workflow
🔇 Additional comments (2)
lib/growthbook.ts (1)
5-6
: LGTM! Safely handles undefined environment variables.The fallback to empty strings ensures the code doesn't throw errors when environment variables are not defined.
theme.config.tsx (1)
137-137
: LGTM! Consistent handling of optional environment variable.The fallback to empty string aligns with the PR's objective and matches the pattern used in GrowthBook configuration.
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.
Merge to main
Make env variables optional