forked from cerc-io/ipld-eth-server
655d1b1d6f
* Functions in pkg should return errors * If aborting is desired, that behavior should be left to the consumer
30 lines
788 B
Go
30 lines
788 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"flag"
|
|
|
|
"github.com/8thlight/vulcanizedb/cmd"
|
|
"github.com/8thlight/vulcanizedb/pkg/blockchain_listener"
|
|
"github.com/8thlight/vulcanizedb/pkg/core"
|
|
"github.com/8thlight/vulcanizedb/pkg/geth"
|
|
"github.com/8thlight/vulcanizedb/pkg/observers"
|
|
)
|
|
|
|
func main() {
|
|
environment := flag.String("environment", "", "Environment name")
|
|
flag.Parse()
|
|
config := cmd.LoadConfig(*environment)
|
|
repository := cmd.LoadPostgres(config.Database)
|
|
fmt.Printf("Creating Geth Blockchain to: %s\n", config.Client.IPCPath)
|
|
listener := blockchain_listener.NewBlockchainListener(
|
|
geth.NewGethBlockchain(config.Client.IPCPath),
|
|
[]core.BlockchainObserver{
|
|
observers.BlockchainLoggingObserver{},
|
|
observers.NewBlockchainDbObserver(repository),
|
|
},
|
|
)
|
|
listener.Start()
|
|
}
|