6
6
"syscall"
7
7
8
8
"github.com/centrifuge/go-centrifuge/cmd"
9
+ "github.com/centrifuge/go-centrifuge/config"
9
10
"github.com/mitchellh/go-homedir"
10
11
"github.com/spf13/cobra"
11
12
"golang.org/x/crypto/ssh/terminal"
16
17
apiPort , p2pPort int64
17
18
bootstraps []string
18
19
centChainURL , centChainID , centChainSecret , centChainAddress string
20
+ identityFactoryAddr string
19
21
)
20
22
21
23
func init () {
@@ -30,30 +32,38 @@ func init() {
30
32
Short : "Configures Node" ,
31
33
Long : `` ,
32
34
Run : func (c * cobra.Command , args []string ) {
33
- _ , err := fmt .Fprintln (os .Stderr , "Enter your Ethereum Account Password:" )
34
- if err != nil {
35
- log .Fatal (err )
36
- }
35
+ var contractAddrs * config.SmartContractAddresses
36
+ var ethPassword string
37
+ if network == "testing" {
38
+ contractAddrs = & config.SmartContractAddresses {IdentityFactoryAddr : identityFactoryAddr }
39
+ } else {
40
+ _ , err := fmt .Fprintln (os .Stderr , "Enter your Ethereum Account Password:" )
41
+ if err != nil {
42
+ log .Fatal (err )
43
+ }
37
44
38
- pwd , err := terminal .ReadPassword (syscall .Stdin )
39
- if err != nil {
40
- // lets take empty password
41
- log .Error (err )
45
+ pwd , err := terminal .ReadPassword (syscall .Stdin )
46
+ if err != nil {
47
+ // lets take empty password
48
+ log .Error (err )
49
+ }
50
+
51
+ ethPassword = string (pwd )
42
52
}
43
53
44
54
err = cmd .CreateConfig (
45
55
targetDataDir ,
46
56
ethNodeURL ,
47
57
accountKeyPath ,
48
- string ( pwd ) ,
58
+ ethPassword ,
49
59
network ,
50
60
apiHost ,
51
61
apiPort ,
52
62
p2pPort ,
53
63
bootstraps ,
54
64
false ,
55
65
"" ,
56
- nil ,
66
+ contractAddrs ,
57
67
"" ,
58
68
centChainURL , centChainID , centChainSecret , centChainAddress )
59
69
if err != nil {
@@ -81,5 +91,7 @@ func init() {
81
91
createConfigCmd .Flags ().StringVar (& centChainID , "centchainid" , "" , "Centrifuge Chain Account ID" )
82
92
createConfigCmd .Flags ().StringVar (& centChainSecret , "centchainsecret" , "" , "Centrifuge Chain Secret URI" )
83
93
createConfigCmd .Flags ().StringVar (& centChainAddress , "centchainaddr" , "" , "Centrifuge Chain ss58addr" )
94
+ createConfigCmd .Flags ().StringVar (& identityFactoryAddr , "identityFactory" , "" ,
95
+ "Ethereum Identity factory address for testing network" )
84
96
rootCmd .AddCommand (createConfigCmd )
85
97
}
0 commit comments