-
Notifications
You must be signed in to change notification settings - Fork 11
cli: fix prod mode for runtime values #178
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
Conversation
📝 WalkthroughWalkthroughThis change refactors the way runtime configuration and preset data are provided to the CLI and indexer processes. It introduces a new static configuration plugin for the Rolldown bundler, which embeds configuration values into a virtual module at build time. The CLI's Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI Process
participant Rolldown as Rolldown Bundler
participant StaticConfig as Static Config Plugin
participant Indexer as Indexer Process
CLI->>Rolldown: Build project
Rolldown->>StaticConfig: Apply staticConfig plugin
StaticConfig-->>Rolldown: Embed config into virtual module
Rolldown-->>CLI: Output bundle with embedded config
CLI->>Indexer: Start indexer with args (preset, --no-standalone, etc.)
Indexer->>StaticConfig: Import config from virtual module
StaticConfig-->>Indexer: Provide preset, presets, runtimeConfig
Indexer->>Indexer: Run using provided configuration
Possibly related PRs
Suggested reviewers
Poem
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (13)
🧰 Additional context used🧬 Code Graph Analysis (3)packages/cli/src/rolldown/config.ts (1)
packages/cli/src/rolldown/plugins/static-config.ts (2)
packages/cli/src/runtime/start.ts (6)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (17)
✨ Finishing Touches
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. 🪧 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
CodeRabbit Configuration File (
|
fracek
left a comment
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.
I tested it and now it works great!
fixes prod indexers missing runtime values when running using
node .apibara/build/start.mjs --indexers starknet.added an internal flag (
--standalonedefault:true) to the runtimestart.mjsto switch between how and from where runtime values are resolved.in
apibara build -> apibara start, we run thestart.mjsas child process with flag--no-standalone, thus runtime values are resolved from internal env variables which are set by theapibaracli itself, basically same as how runtime values are resolved in dev mode.when running indexers using
node, it uses a virtual module created in rolldown during build, which exports static values forruntimeConfig,preset,presetsand also exportsuserEnvRuntimeConfigwhich is JSON parsed value of user's runtime override env variable -APIBARA_RUNTIME_CONFIG.its important to note that in contrast to above,
dev.mjsis only supposed to be run withapibaracli only and NOT withnode.