2017-11-06 17:40:52 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"flag"
|
|
|
|
|
2017-11-09 19:34:58 +00:00
|
|
|
"github.com/8thlight/vulcanizedb/cmd"
|
2017-11-06 18:53:43 +00:00
|
|
|
"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"
|
2017-11-06 17:40:52 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
environment := flag.String("environment", "", "Environment name")
|
|
|
|
flag.Parse()
|
2017-11-09 19:34:58 +00:00
|
|
|
config := cmd.LoadConfig(*environment)
|
2017-11-27 15:39:53 +00:00
|
|
|
fmt.Printf("Creating Geth Blockchain to: %s\n", config.Client.IPCPath)
|
2017-12-07 19:32:16 +00:00
|
|
|
blockchain := geth.NewGethBlockchain(config.Client.IPCPath)
|
|
|
|
repository := cmd.LoadPostgres(config.Database, blockchain.Node())
|
2017-11-09 20:30:24 +00:00
|
|
|
listener := blockchain_listener.NewBlockchainListener(
|
2017-12-07 19:32:16 +00:00
|
|
|
blockchain,
|
2017-11-09 20:30:24 +00:00
|
|
|
[]core.BlockchainObserver{
|
|
|
|
observers.BlockchainLoggingObserver{},
|
|
|
|
observers.NewBlockchainDbObserver(repository),
|
|
|
|
},
|
|
|
|
)
|
2017-11-06 17:40:52 +00:00
|
|
|
listener.Start()
|
|
|
|
}
|