Pass in IPC path as command line argument
This commit is contained in:
parent
de0bdff579
commit
cc05feee3f
@ -13,10 +13,10 @@ type GethBlockchain struct {
|
|||||||
observers []BlockchainObserver
|
observers []BlockchainObserver
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGethBlockchain() *GethBlockchain {
|
func NewGethBlockchain(ipcPath string) *GethBlockchain {
|
||||||
fmt.Println("Creating Geth Blockchain")
|
fmt.Printf("Creating Geth Blockchain to: %s\n", ipcPath)
|
||||||
blockchain := GethBlockchain{}
|
blockchain := GethBlockchain{}
|
||||||
client, _ := ethclient.Dial("/var/folders/b3/z7fhy7cs06q8d7y3_pwwt4x40000gn/T/ethereum_dev_mode/geth.ipc")
|
client, _ := ethclient.Dial(ipcPath)
|
||||||
// TODO: handle error gracefully
|
// TODO: handle error gracefully
|
||||||
blockchain.client = client
|
blockchain.client = client
|
||||||
return &blockchain
|
return &blockchain
|
||||||
|
6
main.go
6
main.go
@ -1,11 +1,15 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"github.com/8thlight/vulcanizedb/core"
|
"github.com/8thlight/vulcanizedb/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var blockchain core.Blockchain = core.NewGethBlockchain()
|
ipcPath := flag.String("ipcPath", "", "location geth.ipc")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
var blockchain core.Blockchain = core.NewGethBlockchain(*ipcPath)
|
||||||
blockchain.RegisterObserver(core.BlockchainLoggingObserver{})
|
blockchain.RegisterObserver(core.BlockchainLoggingObserver{})
|
||||||
blockchain.SubscribeToEvents()
|
blockchain.SubscribeToEvents()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user