Extract loading config to a shared file
This commit is contained in:
@@ -2,11 +2,10 @@ package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"log"
|
||||
|
||||
"fmt"
|
||||
|
||||
"github.com/8thlight/vulcanizedb/pkg/config"
|
||||
"github.com/8thlight/vulcanizedb/cmd"
|
||||
"github.com/8thlight/vulcanizedb/pkg/geth"
|
||||
"github.com/8thlight/vulcanizedb/pkg/history"
|
||||
"github.com/8thlight/vulcanizedb/pkg/repositories"
|
||||
@@ -16,13 +15,10 @@ func main() {
|
||||
environment := flag.String("environment", "", "Environment name")
|
||||
startingBlockNumber := flag.Int("starting-number", -1, "First block to fill from")
|
||||
flag.Parse()
|
||||
cfg, err := config.NewConfig(*environment)
|
||||
if err != nil {
|
||||
log.Fatalf("Error loading config\n%v", err)
|
||||
}
|
||||
config := cmd.LoadConfig(*environment)
|
||||
|
||||
blockchain := geth.NewGethBlockchain(cfg.Client.IPCPath)
|
||||
repository := repositories.NewPostgres(cfg.Database)
|
||||
blockchain := geth.NewGethBlockchain(config.Client.IPCPath)
|
||||
repository := repositories.NewPostgres(config.Database)
|
||||
numberOfBlocksCreated := history.PopulateBlocks(blockchain, repository, int64(*startingBlockNumber))
|
||||
fmt.Printf("Populated %d blocks", numberOfBlocksCreated)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user