-
Notifications
You must be signed in to change notification settings - Fork 87
Add ConfigValue component for dynamic configuration values #1110
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
base: main
Are you sure you want to change the base?
Conversation
- Create ConfigValue React component with TypeScript support - Auto-generates product-config.ts from OpenFGA schema - Provides type-safe configuration value display in MDX - Enhanced update-config-page.mjs to generate generic product-config.ts - Enables multi-tenant documentation with different config values
WalkthroughAdds a script to extract constants from the OpenFGA config schema and generate a TypeScript constants file. Introduces an auto-generated constants module with default config values. Adds a React component to render config default values and re-exports it via the Docs index. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant Script as update-config-page.mjs
participant Schema as OpenFGA Config Schema (JSON)
participant FS as File System
participant TS as product-config.ts
Dev->>Script: Run script
Script->>Schema: Load schema JSON
Script->>Script: extractConstants(properties, jsonData)
Script->>Script: generateConstantsFile(constants, releaseData)
Script->>FS: Write TS content -> product-config.ts
FS-->>TS: product-config.ts available
note over Script,TS: New/updated constants and aggregated defaults exported
sequenceDiagram
autonumber
participant Docs as Docs pages
participant UI as ConfigValue component
participant Const as PRODUCT_CONFIG_DEFAULTS
Docs->>UI: <ConfigValue name="..." format="code|text" />
UI->>Const: Read default by key
alt key exists
UI-->>Docs: Render value (code/span)
else key missing
UI-->>Docs: Render "[Unknown config: ...]" placeholder
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal). Please share your feedback with us on this Discord post. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Summary
This PR introduces a new
ConfigValue
React component that enables dynamic display of configuration values in documentation, supporting multi-tenant deployments with different configuration settings.What's Changed
✨ New ConfigValue Component
code
andtext
formatting options🔧 Auto-Generated Configuration
update-config-page.mjs
now generates genericproduct-config.ts
🏗️ Multi-Tenant Architecture
Usage Example
Technical Details
Files Added
src/components/Docs/ConfigValue/index.tsx
- Main React componentsrc/constants/product-config.ts
- Auto-generated configuration constants (726 lines)Files Modified
scripts/update-config-page.mjs
- Enhanced to generate generic product-configsrc/components/Docs/index.ts
- Export ConfigValue componentKey Features
keyof typeof ProductConfig.PRODUCT_CONFIG_DEFAULTS
Benefits
Testing
This component will be used in future documentation updates to replace hardcoded configuration values.
Summary by CodeRabbit
New Features
Documentation
Chores