Refactor run main.go

This commit is contained in:
Eric Meyer 2017-11-09 14:30:24 -06:00
parent 84205a21ea
commit a655470f18

View File

@ -17,15 +17,15 @@ func main() {
environment := flag.String("environment", "", "Environment name") environment := flag.String("environment", "", "Environment name")
flag.Parse() flag.Parse()
config := cmd.LoadConfig(*environment) config := cmd.LoadConfig(*environment)
fmt.Println("Client Path ", config.Client.IPCPath) fmt.Println("Client Path ", config.Client.IPCPath)
blockchain := geth.NewGethBlockchain(config.Client.IPCPath)
loggingObserver := observers.BlockchainLoggingObserver{}
repository := repositories.NewPostgres(config.Database) repository := repositories.NewPostgres(config.Database)
dbObserver := observers.NewBlockchainDbObserver(repository) listener := blockchain_listener.NewBlockchainListener(
listener := blockchain_listener.NewBlockchainListener(blockchain, []core.BlockchainObserver{ geth.NewGethBlockchain(config.Client.IPCPath),
loggingObserver, []core.BlockchainObserver{
dbObserver, observers.BlockchainLoggingObserver{},
}) observers.NewBlockchainDbObserver(repository),
},
)
listener.Start() listener.Start()
} }