Skip to content

Commit

Permalink
Merge pull request #39 from initia-labs/update-default
Browse files Browse the repository at this point in the history
update config default
  • Loading branch information
SeUkKim authored Apr 29, 2024
2 parents 8d4f87e + 136177d commit c023dd8
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 30 deletions.
18 changes: 0 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,3 @@ Indexer listens StreamingManager's stream and indices streamed data

Registered submodules get abci Events(i.e. FinalizeBlock and Commit) and are allowed to CRUD indexer key-value storage.

### Configuration

Default configuration will be set when the indexer is initialized.
But, to run your indexer properly, you have to set 2 configuration properties.

* set indexer.enable to true in app.toml
* set indexer.l1-chain-id to the L1's chain id app.toml

Here's example:
```toml
[indexer]
enable = true
l1-chain-id = "mahalo-2"

#...other properties..
```

Other properties are okay with default!
9 changes: 1 addition & 8 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const (
flagIndexerEnable = "indexer.enable"
flagIndexerBackend = "indexer.backend"
flagIndexerCacheSize = "indexer.cache-size"
flagL1ChainId = "indexer.l1-chain-id"
)

func NewConfig(appOpts servertypes.AppOptions) (*IndexerConfig, error) {
Expand All @@ -25,7 +24,6 @@ func NewConfig(appOpts servertypes.AppOptions) (*IndexerConfig, error) {
return cfg, nil
}
cfg.CacheSize = cast.ToUint(appOpts.Get(flagIndexerCacheSize))
cfg.L1ChainId = cast.ToString(appOpts.Get(flagL1ChainId))

cfg.BackendConfig = viper.New()
err := cfg.BackendConfig.MergeConfigMap(cast.ToStringMap(appOpts.Get(flagIndexerBackend)))
Expand All @@ -47,10 +45,6 @@ func (c IndexerConfig) Validate() error {
return fmt.Errorf("cache size must be greater than 0")
}

if c.L1ChainId == "" {
return fmt.Errorf("l1 chain id must be set")
}

if c.BackendConfig == nil {
return fmt.Errorf("backend config must be set")
}
Expand All @@ -64,9 +58,8 @@ func (c IndexerConfig) IsEnabled() bool {

func DefaultConfig() IndexerConfig {
return IndexerConfig{
Enable: false,
Enable: true,
CacheSize: 1_000_000,
L1ChainId: "",
BackendConfig: store.DefaultConfig(),
}
}
4 changes: 0 additions & 4 deletions config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
type IndexerConfig struct {
Enable bool `mapstructure:"indexer.enable"`
CacheSize uint `mapstructure:"indexer.cache-size"`
L1ChainId string `mapstructure:"indexer.l1-chain-id"`
BackendConfig *viper.Viper `mapstructure:"indexer.backend"`
}

Expand All @@ -24,9 +23,6 @@ enable = {{ .IndexerConfig.Enable }}
# CacheSize defines the size of the cache.
cache-size = {{ .IndexerConfig.CacheSize }}
# l1-chain-id defines the chain id of the l1 chain.
l1-chain-id = "{{ .IndexerConfig.L1ChainId }}"
# Backend defines the type of the backend store and its options.
# It should have a key-value pair named 'type', and the value should exist in store supported by cosmos-db.
# supported type: "goleveldb" only in current
Expand Down

0 comments on commit c023dd8

Please sign in to comment.