36 lines
778 B
Go
36 lines
778 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"log/slog"
|
||
|
|
||
|
"github.com/cerc-io/eth-blob-indexer/cmd"
|
||
|
"github.com/cerc-io/eth-blob-indexer/pkg/beacon"
|
||
|
"github.com/cerc-io/eth-blob-indexer/pkg/storage"
|
||
|
|
||
|
"github.com/go-redis/redis/v8"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
defaultBeaconAddr = "https://localhost:5052"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
var BeaconAddress string
|
||
|
cmd.Flags.StringVar(&BeaconAddress, "beacon-addr", defaultBeaconAddr, "Address of the beacon node")
|
||
|
cmd.ParseFlags()
|
||
|
|
||
|
indexer := &beacon.BeaconClient{URL: BeaconAddress}
|
||
|
|
||
|
rdb := redis.NewClient(&redis.Options{
|
||
|
Addr: cmd.RedisAddress,
|
||
|
})
|
||
|
db := storage.NewRedisStorage(rdb)
|
||
|
|
||
|
slog.Info("Starting indexer", "beacon", BeaconAddress, "redis", cmd.RedisAddress)
|
||
|
err := indexer.CollectBlobs(context.Background(), db)
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
}
|