Skip to content

Add per-chain enabled flag to config #87

@anhthii

Description

@anhthii

Motivation

Currently, deploying the indexer requires passing --chains=evm,tron,... to specify which chains to index. This is inconvenient for production deployments — every deploy command or Docker entrypoint needs to maintain this list, and adding/removing a chain means updating deployment configs rather than just the application config.

Proposal

Add an enabled field to each chain's configuration in config.yaml. When --chains is not provided, only chains with enabled: true are indexed.

chains:
  tron_mainnet:
    enabled: true
    type: "tron"
    ...
  tron_testnet:
    enabled: false
    type: "tron"
    ...

Behavior:

  • --chains not provided: index only chains where enabled: true (omitting the field defaults to true for backward compatibility)
  • --chains provided: index the specified chains regardless of the enabled flag (preserves current behavior for manual/dev runs)

Implementation

  1. Add Enabled *bool field to ChainConfig in pkg/common/config/types.go
  2. Add EnabledNames() method to Chains in pkg/common/config/chains.go
  3. Use EnabledNames() instead of Names() in cmd/indexer/main.go when no --chains flag is passed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions