-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
122 lines (116 loc) · 3.03 KB
/
main.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
* Copyright (C) 2019 The themis Authors
* This file is part of The themis library.
*
* The themis is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The themis is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with The themis. If not, see <http://www.gnu.org/licenses/>.
*/
package main
import (
"os"
"runtime"
"github.com/saveio/themis/cmd"
"github.com/saveio/themis/cmd/utils"
"github.com/saveio/themis/common/config"
"github.com/saveio/themis/start"
"github.com/urfave/cli"
)
func setupAPP() *cli.App {
app := cli.NewApp()
app.Usage = "Themis CLI"
app.Action = start.StartThemis
app.Version = config.Version
app.Copyright = "Copyright in 2018 The Themis Authors"
app.Commands = []cli.Command{
cmd.AccountCommand,
cmd.InfoCommand,
cmd.AssetCommand,
cmd.ContractCommand,
cmd.ImportCommand,
cmd.ExportCommand,
cmd.TxCommond,
cmd.SigTxCommand,
cmd.MultiSigAddrCommand,
cmd.MultiSigTxCommand,
cmd.SendTxCommand,
cmd.ShowTxCommand,
}
app.Flags = []cli.Flag{
//common setting
utils.ConfigFlag,
utils.LogLevelFlag,
utils.LogDirFlag,
utils.DisableLogFileFlag,
utils.DisableEventLogFlag,
utils.DataDirFlag,
utils.WasmVerifyMethodFlag,
//account setting
utils.WalletFileFlag,
utils.AccountAddressFlag,
utils.AccountPassFlag,
//consensus setting
utils.EnableConsensusFlag,
utils.MaxTxInBlockFlag,
//poc setting
utils.PocBlockPerViewFlag,
//txpool setting
utils.GasPriceFlag,
utils.GasLimitFlag,
utils.TxpoolPreExecDisableFlag,
utils.DisableSyncVerifyTxFlag,
utils.DisableBroadcastNetTxFlag,
//p2p setting
utils.ReservedPeersOnlyFlag,
utils.ReservedPeersFileFlag,
utils.NetworkIdFlag,
utils.NodePortFlag,
utils.HttpInfoPortFlag,
utils.MaxConnInBoundFlag,
utils.MaxConnOutBoundFlag,
utils.MaxConnInBoundForSingleIPFlag,
utils.NumPeersFlag,
utils.EnableProxyFlag,
utils.ProxyServerListFlag,
utils.ProxyServerIdListFlag,
//test mode setting
utils.EnableTestModeFlag,
utils.TestModeGenBlockTimeFlag,
//rpc setting
utils.RPCDisabledFlag,
utils.RPCPortFlag,
utils.RPCLocalEnableFlag,
utils.RPCLocalProtFlag,
//rest setting
utils.RestfulEnableFlag,
utils.RestfulPortFlag,
utils.RestfulMaxConnsFlag,
//graphql setting
utils.GraphQLEnableFlag,
utils.GraphQLPortFlag,
utils.GraphQLMaxConnsFlag,
//ws setting
utils.WsEnabledFlag,
utils.WsPortFlag,
}
app.Before = func(context *cli.Context) error {
runtime.GOMAXPROCS(runtime.NumCPU())
return nil
}
return app
}
func main() {
if err := setupAPP().Run(os.Args); err != nil {
cmd.PrintErrorMsg(err.Error())
os.Exit(1)
}
}