-
Notifications
You must be signed in to change notification settings - Fork 1
/
viper.go
30 lines (26 loc) · 828 Bytes
/
viper.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package context
import (
"github.com/spf13/viper"
rpcclient "github.com/tendermint/tendermint/rpc/client"
"github.com/AdityaSripal/plasma-mvp-sidechain/app"
"github.com/AdityaSripal/plasma-mvp-sidechain/client"
)
// Return a new context with parameters from the command line
func NewClientContextFromViper() ClientContext {
nodeURI := viper.GetString(client.FlagNode)
var rpc rpcclient.Client
if nodeURI != "" {
rpc = rpcclient.NewHTTP(nodeURI, "/websocket")
}
return ClientContext{
Height: viper.GetInt64(client.FlagHeight),
TrustNode: viper.GetBool(client.FlagTrustNode),
Codec: app.MakeCodec(),
InputAddresses: viper.GetString(client.FlagAddress),
NodeURI: nodeURI,
Client: rpc,
Decoder: nil,
UTXOStore: "main",
PlasmaStore: "plasma",
}
}