Skip to content

feat: introduce enabled flag for chains configuration and update indexing logic to use enabled chains#92

Open
vietddude wants to merge 1 commit intomainfrom
feat/add-perchain-enable-config
Open

feat: introduce enabled flag for chains configuration and update indexing logic to use enabled chains#92
vietddude wants to merge 1 commit intomainfrom
feat/add-perchain-enable-config

Conversation

@vietddude
Copy link
Copy Markdown
Collaborator

Summary

This PR adds per-chain enablement in config so deployments no longer need to rely on --chains=... for the default startup path.

When --chains is omitted, the indexer now starts only chains that are enabled in config. When --chains is provided, the CLI still takes precedence and the specified chains are indexed regardless of the config flag.

Closes #87.

Changes

  • add enabled *bool to ChainConfig
  • add defaults.enabled support so chain configs can inherit a default enablement value
  • add Chains.EnabledNames() to return only enabled chains
  • update indexer startup to use enabled chains when no --chains flag is passed
  • add config tests for:
    • omitted enabled behavior
    • inherited default behavior
    • explicit per-chain override behavior
  • update configs/config.example.yaml to document the new pattern with:
    • defaults.enabled: false
    • one explicit per-chain enabled: true example

Behavior

  • --chains not provided:
    • only enabled chains are started
    • if a chain omits enabled, it inherits defaults.enabled when set
    • if neither chain nor defaults sets enabled, the chain remains enabled for backward compatibility
  • --chains provided:
    • the specified chains are started regardless of enabled

Testing

  • env GOCACHE=/tmp/multichain-indexer-go-build-cache go test ./pkg/common/config/...

@vietddude vietddude requested a review from anhthii March 27, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add per-chain enabled flag to config

1 participant