feat(indexer): select network from environment#75
Open
Kubuxu wants to merge 1 commit into
Open
Conversation
Replace the split Ponder configs with one typed configuration selected by PONDER_NETWORK. Embed the config in the indexer image, enforce strict deployment variables, and cover both networks in CI. Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
There was a problem hiding this comment.
Pull request overview
Unifies the indexer’s Ponder configuration into a single typed ponder.config.ts selected by PONDER_NETWORK, and updates Docker/Compose/CI/docs so both mainnet and calibnet indexers run with strict, validated environment variables while preserving network-specific defaults and addresses.
Changes:
- Replace per-network Ponder configs with a unified config + a typed network registry (
indexer/src/networks.ts) selected byPONDER_NETWORK. - Bake the unified config into the indexer image and update Docker Compose services to set
PONDER_NETWORK+ enable strict env validation. - Add automated tests covering network selection and strict env failures; update scripts, CI, and documentation accordingly.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| shared/system-context.ts | Updates documentation reference to the new START_BLOCK source in indexer/src/networks.ts. |
| README.md | Documents rebuild requirement for the baked config and adds per-network dev/codegen commands. |
| indexer/tsconfig.json | Enables TS extension imports + noEmit, and includes tests/unified config in the TS project. |
| indexer/test/networks.test.ts | Adds node:test coverage for env parsing and runtime selection of the Ponder config. |
| indexer/src/networks.ts | Introduces typed per-network registry, defaults, and strict env parsing helpers. |
| indexer/ponder.config.ts | New unified Ponder config selecting chain/db/rpc/addresses by environment. |
| indexer/ponder.config.mainnet.ts | Removes legacy mainnet-specific Ponder config. |
| indexer/ponder.config.calibnet.ts | Removes legacy calibnet-specific Ponder config. |
| indexer/package.json | Adds per-network dev/start/codegen scripts and a test script for the new env/config logic. |
| indexer/Dockerfile | Copies ponder.config.ts into the image and removes the custom entrypoint. |
| indexer/docker-entrypoint.sh | Removes entrypoint that enforced a bind-mounted config (no longer needed). |
| indexer/.gitignore | Stops ignoring ponder.config.ts now that it is a committed source file. |
| indexer/.dockerignore | Stops excluding Ponder config files so the unified config is included in the image build context. |
| docker-compose.yml | Sets PONDER_NETWORK/PONDER_STRICT_ENV for both indexers and removes config bind mounts. |
| .github/workflows/test.yml | Runs new indexer tests and ensures both network codegen paths are exercised in CI. |
| .env.example | Updates guidance to reflect network selection via PONDER_NETWORK in Compose. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PONDER_NETWORKEach network continues to run in a separate Ponder process with its own database and schema.
Testing
npm testnpm run codegen:calibnetnpm run typecheckgit diff --checkDeployment notes
The unified
ponder.config.tsis baked into the indexer image. Existing deployments must rebuild both indexer services when upgrading:No reindex is required for this change.